@@ -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,10 +4,10 @@ |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Behavioral\NullObject; |
6 | 6 | |
7 | -class PrintLogger implements LoggerInterface |
|
8 | -{ |
|
9 | - public function log(string $string) |
|
10 | - { |
|
7 | +class PrintLogger implements LoggerInterface |
|
8 | +{ |
|
9 | + public function log(string $string) |
|
10 | + { |
|
11 | 11 | echo $string; |
12 | 12 | } |
13 | 13 | } |
@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Behavioral\TemplateMethod; |
6 | 6 | |
7 | -class JsonTemplate extends AbstractTemplate |
|
8 | -{ |
|
7 | +class JsonTemplate extends AbstractTemplate |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @return string |
11 | 11 | */ |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Behavioral\TemplateMethod; |
6 | 6 | |
7 | -abstract class AbstractTemplate |
|
8 | -{ |
|
7 | +abstract class AbstractTemplate |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var array |
11 | 11 | */ |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | $this->toDoThings[] = $this->toExecute(); |
24 | 24 | |
25 | 25 | $helper = $this->getHelper(); |
26 | - if ($helper !== null) { |
|
26 | + if ($helper !== null) { |
|
27 | 27 | $this->toDoThings[] = $helper; |
28 | 28 | } |
29 | 29 |
@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Behavioral\TemplateMethod; |
6 | 6 | |
7 | -class HtmlTemplate extends AbstractTemplate |
|
8 | -{ |
|
7 | +class HtmlTemplate extends AbstractTemplate |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @return string |
11 | 11 | */ |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace DesignPattern\Behavioral\Interpreter; |
4 | 4 | |
5 | -class Variable implements ExpressionInterface |
|
6 | -{ |
|
5 | +class Variable implements ExpressionInterface |
|
6 | +{ |
|
7 | 7 | /** |
8 | 8 | * @var string |
9 | 9 | */ |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @param string $name |
16 | 16 | */ |
17 | - public function __construct(string $name) |
|
18 | - { |
|
17 | + public function __construct(string $name) |
|
18 | + { |
|
19 | 19 | $this->name = $name; |
20 | 20 | } |
21 | 21 | |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @throws \InvalidArgumentException |
28 | 28 | */ |
29 | - public function interpret(array $context) |
|
30 | - { |
|
31 | - if (isset($context[$this->name])) { |
|
29 | + public function interpret(array $context) |
|
30 | + { |
|
31 | + if (isset($context[$this->name])) { |
|
32 | 32 | return $context[$this->name]->interpret($context); |
33 | 33 | } |
34 | 34 |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace DesignPattern\Behavioral\Interpreter; |
4 | 4 | |
5 | -class Operation implements ExpressionInterface |
|
6 | -{ |
|
5 | +class Operation implements ExpressionInterface |
|
6 | +{ |
|
7 | 7 | /** |
8 | 8 | * @var \DesignPattern\Behavioral\Interpreter\ExpressionInterface |
9 | 9 | */ |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | ExpressionInterface $left, |
31 | 31 | ExpressionInterface $right, |
32 | 32 | string $operator = '' |
33 | - ) { |
|
33 | + ) { |
|
34 | 34 | $this->left = $left; |
35 | 35 | $this->right = $right; |
36 | 36 | $this->operator = $operator; |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return float|int|mixed|string |
43 | 43 | */ |
44 | - public function interpret(array $context) |
|
45 | - { |
|
44 | + public function interpret(array $context) |
|
45 | + { |
|
46 | 46 | $left = $this->left->interpret($context); |
47 | 47 | $right = $this->right->interpret($context); |
48 | 48 | |
49 | - switch ($this->operator) { |
|
49 | + switch ($this->operator) { |
|
50 | 50 | case '-': |
51 | 51 | return $left - $right; |
52 | 52 | case '*': |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace DesignPattern\Behavioral\Interpreter; |
4 | 4 | |
5 | -interface ExpressionInterface |
|
6 | -{ |
|
5 | +interface ExpressionInterface |
|
6 | +{ |
|
7 | 7 | /** |
8 | 8 | * @param array $context |
9 | 9 | * |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace DesignPattern\Behavioral\Interpreter; |
4 | 4 | |
5 | -class Number implements ExpressionInterface |
|
6 | -{ |
|
5 | +class Number implements ExpressionInterface |
|
6 | +{ |
|
7 | 7 | /** |
8 | 8 | * @var int |
9 | 9 | */ |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @param int $value |
16 | 16 | */ |
17 | - public function __construct(int $value) |
|
18 | - { |
|
17 | + public function __construct(int $value) |
|
18 | + { |
|
19 | 19 | $this->value = $value; |
20 | 20 | } |
21 | 21 |