@@ -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 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 '*': |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\Facade; |
| 6 | 6 | |
| 7 | -class MacOS implements MacOSInterface |
|
| 8 | -{ |
|
| 7 | +class MacOS implements MacOSInterface |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var string |
| 11 | 11 | */ |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @return mixed |
| 46 | 46 | */ |
| 47 | - protected function execute($command) |
|
| 48 | - { |
|
| 49 | - if (in_array($command, ['restart', 'shutdown'], true)) { |
|
| 47 | + protected function execute($command) |
|
| 48 | + {
|
|
| 49 | + if (in_array($command, ['restart', 'shutdown'], true)) {
|
|
| 50 | 50 | return sprintf('The system is executing the %s command...', $command); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\DataMapper; |
| 6 | 6 | |
| 7 | -class Repository |
|
| 8 | -{ |
|
| 7 | +class Repository |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var array |
| 11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @param array $data |
| 18 | 18 | */ |
| 19 | - public function __construct(array $data) |
|
| 20 | - { |
|
| 19 | + public function __construct(array $data) |
|
| 20 | + {
|
|
| 21 | 21 | $this->data = $data; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @return mixed|null |
| 30 | 30 | */ |
| 31 | - public function find(int $id) |
|
| 32 | - { |
|
| 31 | + public function find(int $id) |
|
| 32 | + {
|
|
| 33 | 33 | return $this->data[$id] ?? null; |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\DataMapper; |
| 6 | 6 | |
| 7 | -class User |
|
| 8 | -{ |
|
| 7 | +class User |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var string |
| 11 | 11 | */ |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | * @param string $username |
| 23 | 23 | * @param string $email |
| 24 | 24 | */ |
| 25 | - public function __construct(string $username, string $email) |
|
| 26 | - { |
|
| 25 | + public function __construct(string $username, string $email) |
|
| 26 | + {
|
|
| 27 | 27 | $this->username = $username; |
| 28 | 28 | $this->email = $email; |
| 29 | 29 | } |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\DataMapper; |
| 6 | 6 | |
| 7 | -class UserMapper |
|
| 8 | -{ |
|
| 7 | +class UserMapper |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var \DesignPattern\Structural\DataMapper\Repository |
| 11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @param \DesignPattern\Structural\DataMapper\Repository $repository |
| 18 | 18 | */ |
| 19 | - public function __construct(Repository $repository) |
|
| 20 | - { |
|
| 19 | + public function __construct(Repository $repository) |
|
| 20 | + {
|
|
| 21 | 21 | $this->repository = $repository; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | * @return mixed |
| 30 | 30 | * @throws \InvalidArgumentException |
| 31 | 31 | */ |
| 32 | - public function findById(int $id) |
|
| 33 | - { |
|
| 32 | + public function findById(int $id) |
|
| 33 | + {
|
|
| 34 | 34 | $result = $this->repository->find($id); |
| 35 | 35 | |
| 36 | - if ($result === null) { |
|
| 36 | + if ($result === null) {
|
|
| 37 | 37 | throw new \InvalidArgumentException("User #$id not found.", $id); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\Decorator; |
| 6 | 6 | |
| 7 | -class Webservice implements RenderableInterface |
|
| 8 | -{ |
|
| 7 | +class Webservice implements RenderableInterface |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var string |
| 11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @param string $data |
| 18 | 18 | */ |
| 19 | - public function __construct(string $data) |
|
| 20 | - { |
|
| 19 | + public function __construct(string $data) |
|
| 20 | + {
|
|
| 21 | 21 | $this->data = $data; |
| 22 | 22 | } |
| 23 | 23 | |