@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Behavioral\NullObject; |
6 | 6 | |
7 | -class Service |
|
8 | -{ |
|
7 | +class Service |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var \DesignPattern\Behavioral\NullObject\LoggerInterface |
11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @param \DesignPattern\Behavioral\NullObject\LoggerInterface $logger |
18 | 18 | */ |
19 | - public function __construct(LoggerInterface $logger) |
|
20 | - { |
|
19 | + public function __construct(LoggerInterface $logger) |
|
20 | + { |
|
21 | 21 | $this->logger = $logger; |
22 | 22 | } |
23 | 23 |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Behavioral\Command; |
6 | 6 | |
7 | -class StartupCommand implements CommandInterface |
|
8 | -{ |
|
7 | +class StartupCommand implements CommandInterface |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var \DesignPattern\Behavioral\Command\Computer |
11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @param \DesignPattern\Behavioral\Command\Computer $computer |
18 | 18 | */ |
19 | - public function __construct(Computer $computer) |
|
20 | - { |
|
19 | + public function __construct(Computer $computer) |
|
20 | + { |
|
21 | 21 | $this->computer = $computer; |
22 | 22 | } |
23 | 23 |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Behavioral\Command; |
6 | 6 | |
7 | -class Console |
|
8 | -{ |
|
7 | +class Console |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var \DesignPattern\Behavioral\Command\CommandInterface |
11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @param \DesignPattern\Behavioral\Command\CommandInterface $command |
18 | 18 | */ |
19 | - public function __construct(CommandInterface $command) |
|
20 | - { |
|
19 | + public function __construct(CommandInterface $command) |
|
20 | + { |
|
21 | 21 | $this->command = $command; |
22 | 22 | } |
23 | 23 |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Behavioral\Command; |
6 | 6 | |
7 | -class ShutdownCommand implements CommandInterface |
|
8 | -{ |
|
7 | +class ShutdownCommand implements CommandInterface |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var \DesignPattern\Behavioral\Command\Computer |
11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @param \DesignPattern\Behavioral\Command\Computer $computer |
18 | 18 | */ |
19 | - public function __construct(Computer $computer) |
|
20 | - { |
|
19 | + public function __construct(Computer $computer) |
|
20 | + { |
|
21 | 21 | $this->computer = $computer; |
22 | 22 | } |
23 | 23 |
@@ -15,6 +15,6 @@ |
||
15 | 15 | */ |
16 | 16 | public function format($value): int |
17 | 17 | { |
18 | - return (int)$value; |
|
18 | + return (int) $value; |
|
19 | 19 | } |
20 | 20 | } |
@@ -15,6 +15,6 @@ |
||
15 | 15 | */ |
16 | 16 | public function format($value): string |
17 | 17 | { |
18 | - return (string)trim($value); |
|
18 | + return (string) trim($value); |
|
19 | 19 | } |
20 | 20 | } |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Creational\Multiton; |
6 | 6 | |
7 | -final class Multiton |
|
8 | -{ |
|
7 | +final class Multiton |
|
8 | +{ |
|
9 | 9 | use MultitonTrait; |
10 | 10 | |
11 | 11 | /** |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @param string $value |
20 | 20 | */ |
21 | - private function __construct(string $value) |
|
22 | - { |
|
21 | + private function __construct(string $value) |
|
22 | + { |
|
23 | 23 | $this->value = $value; |
24 | 24 | } |
25 | 25 | } |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Creational\Multiton; |
6 | 6 | |
7 | -trait MultitonTrait |
|
8 | -{ |
|
7 | +trait MultitonTrait |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var array MultitonTrait[] |
11 | 11 | */ |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | $class = static::class; |
26 | 26 | $parameter = \array_slice(\func_get_args(), 1); |
27 | 27 | |
28 | - if (! isset(static::$instances[$identifier])) { |
|
28 | + if (! isset(static::$instances[$identifier])) { |
|
29 | 29 | $reflection = new \ReflectionClass($class); |
30 | 30 | $constructor = $reflection->getConstructor(); |
31 | 31 | $object = $reflection->newInstanceWithoutConstructor(); |
32 | 32 | |
33 | - if ($constructor !== null) { |
|
33 | + if ($constructor !== null) { |
|
34 | 34 | $constructor->setAccessible(true); |
35 | 35 | $constructor->invokeArgs($object, $parameter); |
36 | 36 | } |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @throws \RuntimeException |
63 | 63 | */ |
64 | - private function __clone() |
|
65 | - { |
|
64 | + private function __clone() |
|
65 | + { |
|
66 | 66 | throw new \RuntimeException('Unable to clone a multiton object.'); |
67 | 67 | } |
68 | 68 | |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @throws \RuntimeException |
73 | 73 | */ |
74 | - public function __wakeup() |
|
75 | - { |
|
74 | + public function __wakeup() |
|
75 | + { |
|
76 | 76 | throw new \RuntimeException('Unable to unserialize a multiton object.'); |
77 | 77 | } |
78 | 78 | } |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Creational\Prototype; |
6 | 6 | |
7 | -abstract class Prototype |
|
8 | -{ |
|
7 | +abstract class Prototype |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @return mixed |
11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @return bool |
18 | 18 | */ |
19 | - public function __isset(string $property) |
|
20 | - { |
|
19 | + public function __isset(string $property) |
|
20 | + { |
|
21 | 21 | return isset($this->{$property}); |
22 | 22 | } |
23 | 23 | |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | * @param string $property |
26 | 26 | * @param mixed $value |
27 | 27 | */ |
28 | - public function __set(string $property, $value) |
|
29 | - { |
|
28 | + public function __set(string $property, $value) |
|
29 | + { |
|
30 | 30 | $this->{$property} = $value; |
31 | 31 | } |
32 | 32 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return null |
37 | 37 | */ |
38 | - public function __get(string $property) |
|
39 | - { |
|
40 | - if (property_exists($this, $property)) { |
|
38 | + public function __get(string $property) |
|
39 | + { |
|
40 | + if (property_exists($this, $property)) { |
|
41 | 41 | return $this->{$property}; |
42 | 42 | } |
43 | 43 |