@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Structural\DataMapper; |
6 | 6 | |
7 | -class UserMapper |
|
8 | -{ |
|
7 | +class UserMapper |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var \DesignPattern\Structural\DataMapper\Repository |
11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @param \DesignPattern\Structural\DataMapper\Repository $repository |
18 | 18 | */ |
19 | - public function __construct(Repository $repository) |
|
20 | - { |
|
19 | + public function __construct(Repository $repository) |
|
20 | + { |
|
21 | 21 | $this->repository = $repository; |
22 | 22 | } |
23 | 23 | |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | * @return mixed |
30 | 30 | * @throws \InvalidArgumentException |
31 | 31 | */ |
32 | - public function findById(int $id) |
|
33 | - { |
|
32 | + public function findById(int $id) |
|
33 | + { |
|
34 | 34 | $result = $this->repository->find($id); |
35 | 35 | |
36 | - if ($result === null) { |
|
36 | + if ($result === null) { |
|
37 | 37 | throw new \InvalidArgumentException("User #$id not found.", $id); |
38 | 38 | } |
39 | 39 |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Structural\DataMapper; |
6 | 6 | |
7 | -class User |
|
8 | -{ |
|
7 | +class User |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var string |
11 | 11 | */ |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | * @param string $username |
23 | 23 | * @param string $email |
24 | 24 | */ |
25 | - public function __construct(string $username, string $email) |
|
26 | - { |
|
25 | + public function __construct(string $username, string $email) |
|
26 | + { |
|
27 | 27 | $this->username = $username; |
28 | 28 | $this->email = $email; |
29 | 29 | } |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Structural\DataMapper; |
6 | 6 | |
7 | -class Repository |
|
8 | -{ |
|
7 | +class Repository |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var array |
11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @param array $data |
18 | 18 | */ |
19 | - public function __construct(array $data) |
|
20 | - { |
|
19 | + public function __construct(array $data) |
|
20 | + { |
|
21 | 21 | $this->data = $data; |
22 | 22 | } |
23 | 23 | |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return mixed|null |
30 | 30 | */ |
31 | - public function find(int $id) |
|
32 | - { |
|
31 | + public function find(int $id) |
|
32 | + { |
|
33 | 33 | return $this->data[$id] ?? null; |
34 | 34 | } |
35 | 35 | } |