@@ -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 @@ |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Creational\FactoryMethod; |
6 | 6 | |
7 | -abstract class FactoryMethod |
|
8 | -{ |
|
7 | +abstract class FactoryMethod |
|
8 | +{ |
|
9 | 9 | public const LOW_CONFIG = 1; |
10 | 10 | public const MEDIUM_CONFIG = 2; |
11 | 11 | public const HIGH_CONFIG = 3; |
@@ -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 | } |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Creational\Pool; |
6 | 6 | |
7 | -class StringReverseWorker |
|
8 | -{ |
|
7 | +class StringReverseWorker |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var \DateTime |
11 | 11 | */ |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * StringReverseWorker constructor. |
16 | 16 | */ |
17 | - public function __construct() |
|
18 | - { |
|
17 | + public function __construct() |
|
18 | + { |
|
19 | 19 | $this->createdAt = new \DateTime(); |
20 | 20 | } |
21 | 21 |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Creational\Pool; |
6 | 6 | |
7 | -class Pool implements \Countable |
|
8 | -{ |
|
7 | +class Pool implements \Countable |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var array StringReverseWorker[] |
11 | 11 | */ |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function get(): StringReverseWorker |
25 | 25 | { |
26 | - if (count($this->freeWorker) === 0) { |
|
26 | + if (count($this->freeWorker) === 0) { |
|
27 | 27 | $worker = new StringReverseWorker(); |
28 | - } else { |
|
28 | + } else { |
|
29 | 29 | $worker = array_pop($this->freeWorker); |
30 | 30 | } |
31 | 31 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $key = spl_object_hash($worker); |
45 | 45 | |
46 | - if (isset($this->usedWorker[$key])) { |
|
46 | + if (isset($this->usedWorker[$key])) { |
|
47 | 47 | unset($this->usedWorker[$key]); |
48 | 48 | $this->freeWorker[$key] = $worker; |
49 | 49 | } |
@@ -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 @@ |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Creational\AbstractFactory; |
6 | 6 | |
7 | -abstract class AbstractFactory |
|
8 | -{ |
|
7 | +abstract class AbstractFactory |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * Create a Image component. |
11 | 11 | * |
@@ -7,8 +7,8 @@ |
||
7 | 7 | use DesignPattern\Creational\AbstractFactory\Html\Image as HtmlImage; |
8 | 8 | use DesignPattern\Creational\AbstractFactory\Html\Text as HtmlText; |
9 | 9 | |
10 | -class HtmlFactory extends AbstractFactory |
|
11 | -{ |
|
10 | +class HtmlFactory extends AbstractFactory |
|
11 | +{ |
|
12 | 12 | /** |
13 | 13 | * Create a Image component implementation. |
14 | 14 | * |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Creational\AbstractFactory; |
6 | 6 | |
7 | -abstract class Text implements RendererInterface |
|
8 | -{ |
|
7 | +abstract class Text implements RendererInterface |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var string |
11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @param string $text |
18 | 18 | */ |
19 | - public function __construct(string $text) |
|
20 | - { |
|
19 | + public function __construct(string $text) |
|
20 | + { |
|
21 | 21 | $this->text = $text; |
22 | 22 | } |
23 | 23 | } |