@@ -4,6 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Creational\Builder\Component; |
| 6 | 6 | |
| 7 | -class Brand |
|
| 8 | -{ |
|
| 7 | +class Brand |
|
| 8 | +{
|
|
| 9 | 9 | } |
@@ -4,6 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Creational\Builder\Component; |
| 6 | 6 | |
| 7 | -class Storage |
|
| 8 | -{ |
|
| 7 | +class Storage |
|
| 8 | +{
|
|
| 9 | 9 | } |
@@ -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 | */ |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Creational\Singleton; |
| 6 | 6 | |
| 7 | -final class Singleton |
|
| 8 | -{ |
|
| 7 | +final class Singleton |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * Singleton reference to singleton instance. |
| 11 | 11 | * |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public static function getInstance(): Singleton |
| 27 | 27 | { |
| 28 | - if (null === self::$instance) { |
|
| 28 | + if (null === self::$instance) {
|
|
| 29 | 29 | self::$instance = new self(); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | * to prevent creating a new instance outside of the class via |
| 40 | 40 | * the new operator. |
| 41 | 41 | */ |
| 42 | - private function __construct() |
|
| 43 | - { |
|
| 42 | + private function __construct() |
|
| 43 | + {
|
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | * to prevent cloning of an instance of the class via |
| 51 | 51 | * the clone operator. |
| 52 | 52 | */ |
| 53 | - private function __clone() |
|
| 54 | - { |
|
| 53 | + private function __clone() |
|
| 54 | + {
|
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | * to prevent unserializing of an instance of the class via |
| 62 | 62 | * the global function unserialize(). |
| 63 | 63 | */ |
| 64 | - private function __wakeup() |
|
| 65 | - { |
|
| 64 | + private function __wakeup() |
|
| 65 | + {
|
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * to prevent unserializing of an instance of the class via |
| 73 | 73 | * the global function serialize(). |
| 74 | 74 | */ |
| 75 | - private function __sleep() |
|
| 76 | - { |
|
| 75 | + private function __sleep() |
|
| 76 | + {
|
|
| 77 | 77 | } |
| 78 | 78 | } |
@@ -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 | - private function __wakeup() |
|
| 75 | - { |
|
| 74 | + private function __wakeup() |
|
| 75 | + {
|
|
| 76 | 76 | throw new \RuntimeException('Unable to unserialize a multiton object.'); |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Creational\Multiton; |
| 6 | 6 | |
| 7 | -final class Multiton |
|
| 8 | -{ |
|
| 7 | +final class Multiton |
|
| 8 | +{
|
|
| 9 | 9 | use MultitonTrait; |
| 10 | 10 | |
| 11 | 11 | /** |
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @param string $value |
| 20 | 20 | */ |
| 21 | - private function __construct(string $value) |
|
| 22 | - { |
|
| 21 | + private function __construct(string $value) |
|
| 22 | + {
|
|
| 23 | 23 | $this->value = $value; |
| 24 | 24 | } |
| 25 | 25 | } |