@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Creational\AbstractFactory; |
6 | 6 | |
7 | -abstract class Image implements RendererInterface |
|
8 | -{ |
|
7 | +abstract class Image implements RendererInterface |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var string |
11 | 11 | */ |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | * @param string $path |
23 | 23 | * @param string $title |
24 | 24 | */ |
25 | - public function __construct(string $path, string $title = '') |
|
26 | - { |
|
25 | + public function __construct(string $path, string $title = '') |
|
26 | + { |
|
27 | 27 | $this->path = $path; |
28 | 28 | $this->title = $title; |
29 | 29 | } |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Creational\FactoryMethod; |
6 | 6 | |
7 | -class MacBookAir implements NotebookInterface |
|
8 | -{ |
|
7 | +class MacBookAir implements NotebookInterface |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var string |
11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @param string $color |
18 | 18 | */ |
19 | - public function setColor(string $color) |
|
20 | - { |
|
19 | + public function setColor(string $color) |
|
20 | + { |
|
21 | 21 | $this->color = $color; |
22 | 22 | } |
23 | 23 | } |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Creational\FactoryMethod; |
6 | 6 | |
7 | -class MacBook implements NotebookInterface |
|
8 | -{ |
|
7 | +class MacBook implements NotebookInterface |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var string |
11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @param string $color |
18 | 18 | */ |
19 | - public function setColor(string $color) |
|
20 | - { |
|
19 | + public function setColor(string $color) |
|
20 | + { |
|
21 | 21 | $this->color = $color; |
22 | 22 | } |
23 | 23 | } |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Creational\FactoryMethod; |
6 | 6 | |
7 | -class MacBookPro implements NotebookInterface |
|
8 | -{ |
|
7 | +class MacBookPro implements NotebookInterface |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var string |
11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @param string $color |
18 | 18 | */ |
19 | - public function setColor(string $color) |
|
20 | - { |
|
19 | + public function setColor(string $color) |
|
20 | + { |
|
21 | 21 | $this->color = $color; |
22 | 22 | } |
23 | 23 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | public function createNotebook(string $brand): NotebookInterface |
19 | 19 | { |
20 | 20 | $brand = strtolower(trim($brand)); |
21 | - switch ((int)$brand) { |
|
21 | + switch ((int) $brand) { |
|
22 | 22 | case parent::LOW_CONFIG: |
23 | 23 | return new MacBookAir(); |
24 | 24 | case parent::MEDIUM_CONFIG: |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Creational\FactoryMethod; |
6 | 6 | |
7 | -class FoxconnFactory extends FactoryMethod |
|
8 | -{ |
|
7 | +class FoxconnFactory extends FactoryMethod |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * {@inheritdoc} |
11 | 11 | * |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | public function createNotebook(string $brand): NotebookInterface |
19 | 19 | { |
20 | 20 | $brand = strtolower(trim($brand)); |
21 | - switch ((int)$brand) { |
|
21 | + switch ((int)$brand) { |
|
22 | 22 | case parent::LOW_CONFIG: |
23 | 23 | return new MacBookAir(); |
24 | 24 | case parent::MEDIUM_CONFIG: |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Creational\Singleton; |
6 | 6 | |
7 | -final class Singleton |
|
8 | -{ |
|
7 | +final class Singleton |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * Singleton reference to singleton instance. |
11 | 11 | * |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public static function getInstance(): Singleton |
27 | 27 | { |
28 | - if (null === self::$instance) { |
|
28 | + if (null === self::$instance) { |
|
29 | 29 | self::$instance = new self(); |
30 | 30 | } |
31 | 31 | |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | * to prevent creating a new instance outside of the class via |
40 | 40 | * the new operator. |
41 | 41 | */ |
42 | - private function __construct() |
|
43 | - { |
|
42 | + private function __construct() |
|
43 | + { |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * to prevent cloning of an instance of the class via |
51 | 51 | * the clone operator. |
52 | 52 | */ |
53 | - private function __clone() |
|
54 | - { |
|
53 | + private function __clone() |
|
54 | + { |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @throws \RuntimeException |
65 | 65 | */ |
66 | - public function __wakeup() |
|
67 | - { |
|
66 | + public function __wakeup() |
|
67 | + { |
|
68 | 68 | throw new \RuntimeException('Unable to unserialize a singleton object.'); |
69 | 69 | } |
70 | 70 | |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * to prevent serialize of an instance of the class via |
76 | 76 | * the global function serialize(). |
77 | 77 | */ |
78 | - public function __sleep() |
|
79 | - { |
|
78 | + public function __sleep() |
|
79 | + { |
|
80 | 80 | throw new \RuntimeException('Unable to serialize a singleton object.'); |
81 | 81 | } |
82 | 82 | } |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\More\Repository; |
6 | 6 | |
7 | -class User |
|
8 | -{ |
|
7 | +class User |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var int|null |
11 | 11 | */ |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | * @param string $username |
29 | 29 | * @param string $email |
30 | 30 | */ |
31 | - public function __construct(int $id, string $username, string $email) |
|
32 | - { |
|
31 | + public function __construct(int $id, string $username, string $email) |
|
32 | + { |
|
33 | 33 | $this->id = $id; |
34 | 34 | $this->username = $username; |
35 | 35 | $this->email = $email; |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\More\Repository; |
6 | 6 | |
7 | -class UserRepository implements RepositoryInterface |
|
8 | -{ |
|
7 | +class UserRepository implements RepositoryInterface |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var \DesignPattern\More\Repository\MemoryStorage |
11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @param \DesignPattern\More\Repository\MemoryStorage $storage |
18 | 18 | */ |
19 | - public function __construct(MemoryStorage $storage) |
|
20 | - { |
|
19 | + public function __construct(MemoryStorage $storage) |
|
20 | + { |
|
21 | 21 | $this->storage = $storage; |
22 | 22 | } |
23 | 23 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | $array = $this->storage->read($id); |
36 | 36 | |
37 | - if ($array === null) { |
|
37 | + if ($array === null) { |
|
38 | 38 | $message = sprintf('User with ID #%d does not exist.', $id); |
39 | 39 | throw new \InvalidArgumentException($message); |
40 | 40 | } |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\More\EntityAttributeValue; |
6 | 6 | |
7 | -class Attribute |
|
8 | -{ |
|
7 | +class Attribute |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var \SplObjectStorage |
11 | 11 | */ |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param string $name |
23 | 23 | */ |
24 | - public function __construct(string $name) |
|
25 | - { |
|
24 | + public function __construct(string $name) |
|
25 | + { |
|
26 | 26 | $this->storage = new \SplObjectStorage(); |
27 | 27 | $this->name = $name; |
28 | 28 | } |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * @return string |
50 | 50 | */ |
51 | - public function __toString() |
|
52 | - { |
|
51 | + public function __toString() |
|
52 | + { |
|
53 | 53 | return $this->name; |
54 | 54 | } |
55 | 55 | } |