@@ -4,12 +4,12 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Creational\Prototype; |
| 6 | 6 | |
| 7 | -class FooPrototype extends Prototype |
|
| 8 | -{ |
|
| 7 | +class FooPrototype extends Prototype |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * Empty clone. |
| 11 | 11 | */ |
| 12 | - public function __clone() |
|
| 13 | - { |
|
| 12 | + public function __clone() |
|
| 13 | + {
|
|
| 14 | 14 | } |
| 15 | 15 | } |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | namespace DesignPattern\Structural\Flyweight; |
| 4 | 4 | |
| 5 | -class ExpandBullet extends AbstractBullet |
|
| 6 | -{ |
|
| 5 | +class ExpandBullet extends AbstractBullet |
|
| 6 | +{
|
|
| 7 | 7 | /** |
| 8 | 8 | * Intrinsic state. |
| 9 | 9 | * |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * ExpandBullet constructor. |
| 16 | 16 | */ |
| 17 | - public function __construct() |
|
| 18 | - { |
|
| 17 | + public function __construct() |
|
| 18 | + {
|
|
| 19 | 19 | $this->damage = 100; |
| 20 | 20 | } |
| 21 | 21 | } |
@@ -2,8 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace DesignPattern\Structural\Flyweight; |
| 4 | 4 | |
| 5 | -abstract class AbstractBullet implements BulletInterface |
|
| 6 | -{ |
|
| 5 | +abstract class AbstractBullet implements BulletInterface |
|
| 6 | +{
|
|
| 7 | 7 | /** |
| 8 | 8 | * Extrinsic state. |
| 9 | 9 | * |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | namespace DesignPattern\Structural\Flyweight; |
| 4 | 4 | |
| 5 | -class EmptyBullet extends AbstractBullet |
|
| 6 | -{ |
|
| 5 | +class EmptyBullet extends AbstractBullet |
|
| 6 | +{
|
|
| 7 | 7 | /** |
| 8 | 8 | * Intrinsic state. |
| 9 | 9 | * |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * EmptyBullet constructor. |
| 16 | 16 | */ |
| 17 | - public function __construct() |
|
| 18 | - { |
|
| 17 | + public function __construct() |
|
| 18 | + {
|
|
| 19 | 19 | $this->damage = 0; |
| 20 | 20 | } |
| 21 | 21 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | public static function getInstance(string $type): BulletInterface |
| 20 | 20 | { |
| 21 | - if (! array_key_exists($type, self::$bullets)) { |
|
| 21 | + if ( ! array_key_exists($type, self::$bullets)) { |
|
| 22 | 22 | if ($type === 'EmptyBullet') { |
| 23 | 23 | self::$bullets[$type] = new EmptyBullet(); |
| 24 | 24 | } elseif ($type === 'ExpandBullet') { |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | namespace DesignPattern\Structural\Flyweight; |
| 4 | 4 | |
| 5 | -class BulletFactory |
|
| 6 | -{ |
|
| 5 | +class BulletFactory |
|
| 6 | +{
|
|
| 7 | 7 | /** |
| 8 | 8 | * @var array|\DesignPattern\Structural\Flyweight\BulletInterface[] |
| 9 | 9 | */ |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public static function getInstance(string $type): BulletInterface |
| 20 | 20 | { |
| 21 | - if (! array_key_exists($type, self::$bullets)) { |
|
| 22 | - if ($type === 'EmptyBullet') { |
|
| 21 | + if (! array_key_exists($type, self::$bullets)) {
|
|
| 22 | + if ($type === 'EmptyBullet') {
|
|
| 23 | 23 | self::$bullets[$type] = new EmptyBullet(); |
| 24 | - } elseif ($type === 'ExpandBullet') { |
|
| 24 | + } elseif ($type === 'ExpandBullet') {
|
|
| 25 | 25 | self::$bullets[$type] = new ExpandBullet(); |
| 26 | 26 | } |
| 27 | 27 | } |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\Adapter; |
| 6 | 6 | |
| 7 | -interface MemberInterface |
|
| 8 | -{ |
|
| 7 | +interface MemberInterface |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * Get member token. |
| 11 | 11 | * |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\Adapter; |
| 6 | 6 | |
| 7 | -interface UserInterface |
|
| 8 | -{ |
|
| 7 | +interface UserInterface |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * Login. |
| 11 | 11 | * |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\Adapter; |
| 6 | 6 | |
| 7 | -class User implements UserInterface |
|
| 8 | -{ |
|
| 7 | +class User implements UserInterface |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var int |
| 11 | 11 | */ |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\Adapter; |
| 6 | 6 | |
| 7 | -class Weibo implements MemberInterface |
|
| 8 | -{ |
|
| 7 | +class Weibo implements MemberInterface |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var int |
| 11 | 11 | */ |