-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathUser.php
More file actions
31 lines (26 loc) · 664 Bytes
/
Copy pathUser.php
File metadata and controls
31 lines (26 loc) · 664 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
declare(strict_types=1);
namespace App\Structural\DependencyInjection;
class User
{
public function __construct(private Storage $userStorage)
{
}
protected function validate(string $email, string $password): bool
{
if (mb_strlen($email) > 3 && mb_strlen($password) > 3) {
return true;
} else {
return false;
}
}
public function register(string $email, string $password): bool
{
if ($this->validate($email, $password)
&& $this->userStorage->save($email, $password)) {
return true;
} else {
return false;
}
}
}