@@ -4,6 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Creational\Builder\Component; |
| 6 | 6 | |
| 7 | -class Input |
|
| 8 | -{ |
|
| 7 | +class Input |
|
| 8 | +{
|
|
| 9 | 9 | } |
@@ -4,6 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Creational\Builder\Component; |
| 6 | 6 | |
| 7 | -class Output |
|
| 8 | -{ |
|
| 7 | +class Output |
|
| 8 | +{
|
|
| 9 | 9 | } |
@@ -4,6 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Creational\Builder\Component; |
| 6 | 6 | |
| 7 | -class Chassis |
|
| 8 | -{ |
|
| 7 | +class Chassis |
|
| 8 | +{
|
|
| 9 | 9 | } |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Creational\Builder\Component; |
| 6 | 6 | |
| 7 | -abstract class Computer |
|
| 8 | -{ |
|
| 7 | +abstract class Computer |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var array |
| 11 | 11 | */ |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | $class = static::class; |
| 26 | 26 | $parameter = \array_slice(\func_get_args(), 1); |
| 27 | 27 | |
| 28 | - if (! isset(static::$instances[$identifier])) { |
|
| 28 | + if ( ! isset(static::$instances[$identifier])) { |
|
| 29 | 29 | $reflection = new \ReflectionClass($class); |
| 30 | 30 | $constructor = $reflection->getConstructor(); |
| 31 | 31 | $object = $reflection->newInstanceWithoutConstructor(); |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Creational\Multiton; |
| 6 | 6 | |
| 7 | -trait MultitonTrait |
|
| 8 | -{ |
|
| 7 | +trait MultitonTrait |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var array MultitonTrait[] |
| 11 | 11 | */ |
@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | $class = static::class; |
| 26 | 26 | $parameter = \array_slice(\func_get_args(), 1); |
| 27 | 27 | |
| 28 | - if (! isset(static::$instances[$identifier])) { |
|
| 28 | + if (! isset(static::$instances[$identifier])) {
|
|
| 29 | 29 | $reflection = new \ReflectionClass($class); |
| 30 | 30 | $constructor = $reflection->getConstructor(); |
| 31 | 31 | $object = $reflection->newInstanceWithoutConstructor(); |
| 32 | 32 | |
| 33 | - if ($constructor !== null) { |
|
| 33 | + if ($constructor !== null) {
|
|
| 34 | 34 | $constructor->setAccessible(true); |
| 35 | 35 | $constructor->invokeArgs($object, $parameter); |
| 36 | 36 | } |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | * |
| 62 | 62 | * @throws \RuntimeException |
| 63 | 63 | */ |
| 64 | - private function __clone() |
|
| 65 | - { |
|
| 64 | + private function __clone() |
|
| 65 | + {
|
|
| 66 | 66 | throw new \RuntimeException('Unable to clone a multiton object.'); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | * |
| 72 | 72 | * @throws \RuntimeException |
| 73 | 73 | */ |
| 74 | - public function __wakeup() |
|
| 75 | - { |
|
| 74 | + public function __wakeup() |
|
| 75 | + {
|
|
| 76 | 76 | throw new \RuntimeException('Unable to unserialize a multiton object.'); |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Creational\StaticFactory; |
| 6 | 6 | |
| 7 | -interface FormatterInterface |
|
| 8 | -{ |
|
| 7 | +interface FormatterInterface |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * Format value. |
| 11 | 11 | * |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Creational\StaticFactory; |
| 6 | 6 | |
| 7 | -class FormatterNumber implements FormatterInterface |
|
| 8 | -{ |
|
| 7 | +class FormatterNumber implements FormatterInterface |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * Format value. |
| 11 | 11 | * |
@@ -15,6 +15,6 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function format($value): int |
| 17 | 17 | { |
| 18 | - return (int)$value; |
|
| 18 | + return (int) $value; |
|
| 19 | 19 | } |
| 20 | 20 | } |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Creational\StaticFactory; |
| 6 | 6 | |
| 7 | -class FormatterString implements FormatterInterface |
|
| 8 | -{ |
|
| 7 | +class FormatterString implements FormatterInterface |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * Format value. |
| 11 | 11 | * |
@@ -15,6 +15,6 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function format($value): string |
| 17 | 17 | { |
| 18 | - return (string)trim($value); |
|
| 18 | + return (string) trim($value); |
|
| 19 | 19 | } |
| 20 | 20 | } |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | { |
| 20 | 20 | $class = __NAMESPACE__ . '\Formatter' . ucfirst($type); |
| 21 | 21 | |
| 22 | - if (! class_exists($class)) { |
|
| 22 | + if ( ! class_exists($class)) { |
|
| 23 | 23 | throw new \InvalidArgumentException("$class is not found."); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Creational\StaticFactory; |
| 6 | 6 | |
| 7 | -final class StaticFactory |
|
| 8 | -{ |
|
| 7 | +final class StaticFactory |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * Create a static factory class. |
| 11 | 11 | * |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | { |
| 20 | 20 | $class = __NAMESPACE__ . '\Formatter' . ucfirst($type); |
| 21 | 21 | |
| 22 | - if (! class_exists($class)) { |
|
| 22 | + if (! class_exists($class)) {
|
|
| 23 | 23 | throw new \InvalidArgumentException("$class is not found."); |
| 24 | 24 | } |
| 25 | 25 | |