@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Behavioral\Observer\Npl; |
6 | 6 | |
7 | -interface SubjectInterface |
|
8 | -{ |
|
7 | +interface SubjectInterface |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * Attach an ObserverInterface. |
11 | 11 | * |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Behavioral\Observer\Npl; |
6 | 6 | |
7 | -class Observer implements ObserverInterface |
|
8 | -{ |
|
7 | +class Observer implements ObserverInterface |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * Receive update from subject. |
11 | 11 | * |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | * |
14 | 14 | * @return mixed|void |
15 | 15 | */ |
16 | - public function update(SubjectInterface $subject) |
|
17 | - { |
|
16 | + public function update(SubjectInterface $subject) |
|
17 | + { |
|
18 | 18 | echo sprintf('Subject author is %s.', $subject->getAuthor()); |
19 | 19 | } |
20 | 20 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | int $code, |
32 | 32 | string $message, |
33 | 33 | SubjectInterface $subject |
34 | - ) { |
|
34 | + ) { |
|
35 | 35 | // TODO: Implement report() method. |
36 | 36 | } |
37 | 37 | } |
@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Behavioral\Observer\Npl; |
6 | 6 | |
7 | -interface ObserverInterface |
|
8 | -{ |
|
7 | +interface ObserverInterface |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * Receive update from subject. |
11 | 11 | * |
@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Behavioral\Observer\Spl; |
6 | 6 | |
7 | -class ProductObserver implements \SplObserver |
|
8 | -{ |
|
7 | +class ProductObserver implements \SplObserver |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * Update product price. |
11 | 11 | * |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Behavioral\Memento; |
6 | 6 | |
7 | -class History implements \Countable |
|
8 | -{ |
|
7 | +class History implements \Countable |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var \DesignPattern\Behavioral\Memento\Memento[] |
11 | 11 | */ |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * History constructor. |
16 | 16 | */ |
17 | - public function __construct() |
|
18 | - { |
|
17 | + public function __construct() |
|
18 | + { |
|
19 | 19 | $this->mementos = []; |
20 | 20 | } |
21 | 21 | |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @return \DesignPattern\Behavioral\Memento\Memento|mixed|null |
36 | 36 | */ |
37 | - public function popMemento() |
|
38 | - { |
|
39 | - if ($this->count() > 0) { |
|
37 | + public function popMemento() |
|
38 | + { |
|
39 | + if ($this->count() > 0) { |
|
40 | 40 | return array_pop($this->mementos); |
41 | 41 | } |
42 | 42 |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Behavioral\Memento; |
6 | 6 | |
7 | -class State |
|
8 | -{ |
|
7 | +class State |
|
8 | +{ |
|
9 | 9 | public const STATUS_LOCKED = 1; |
10 | 10 | public const STATUS_CONFIRMED = 2; |
11 | 11 | public const STATUS_PAID = 3; |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @throws \Exception|\InvalidArgumentException |
47 | 47 | */ |
48 | - public function __construct($state = self::STATUS_LOCKED) |
|
49 | - { |
|
48 | + public function __construct($state = self::STATUS_LOCKED) |
|
49 | + { |
|
50 | 50 | self::isValidState($state); |
51 | 51 | |
52 | 52 | $this->state = $state; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | private static function isValidState(int $state): void |
66 | 66 | { |
67 | - if (! in_array($state, self::$validStates, true)) { |
|
67 | + if (! in_array($state, self::$validStates, true)) { |
|
68 | 68 | throw new \InvalidArgumentException('Invalid state given.'); |
69 | 69 | } |
70 | 70 | } |
@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Behavioral\Strategy; |
6 | 6 | |
7 | -interface ComparatorInterface |
|
8 | -{ |
|
7 | +interface ComparatorInterface |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * Compare the two given values. |
11 | 11 | * |
@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Behavioral\Strategy; |
6 | 6 | |
7 | -class IdentifyComparator implements ComparatorInterface |
|
8 | -{ |
|
7 | +class IdentifyComparator implements ComparatorInterface |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * Compare the two given id values. |
11 | 11 | * |
@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Behavioral\Strategy; |
6 | 6 | |
7 | -class DateComparator implements ComparatorInterface |
|
8 | -{ |
|
7 | +class DateComparator implements ComparatorInterface |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * Compare the two given date values. |
11 | 11 | * |