@@ -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 | } |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace DesignPattern\Structural\Flyweight; |
4 | 4 | |
5 | -class Gun |
|
6 | -{ |
|
5 | +class Gun |
|
6 | +{ |
|
7 | 7 | /** |
8 | 8 | * @var array|BulletInterface[] |
9 | 9 | */ |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @param int $maxBullets |
21 | 21 | */ |
22 | - public function __construct(int $maxBullets) |
|
23 | - { |
|
22 | + public function __construct(int $maxBullets) |
|
23 | + { |
|
24 | 24 | $this->bullets = []; |
25 | 25 | $this->maxBullets = $maxBullets; |
26 | 26 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function reload(string $type): void |
50 | 50 | { |
51 | 51 | $count = \count($this->bullets); |
52 | - for (; $count < $this->maxBullets; $count++) { |
|
52 | + for (; $count < $this->maxBullets; $count++) { |
|
53 | 53 | $this->bullets[] = BulletFactory::getInstance($type); |
54 | 54 | } |
55 | 55 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function fire(): string |
61 | 61 | { |
62 | - if ($count = \count($this->bullets)) { |
|
62 | + if ($count = \count($this->bullets)) { |
|
63 | 63 | $bullet = \array_shift($this->bullets); |
64 | 64 | $bullet->setPositionInMagazine($this->maxBullets - $count + 1); |
65 | 65 |
@@ -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 @@ discard block |
||
4 | 4 | |
5 | 5 | namespace DesignPattern\Structural\Adapter; |
6 | 6 | |
7 | -class UserAdapter implements UserInterface |
|
8 | -{ |
|
7 | +class UserAdapter implements UserInterface |
|
8 | +{ |
|
9 | 9 | /** |
10 | 10 | * @var \DesignPattern\Structural\Adapter\MemberInterface |
11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @param \DesignPattern\Structural\Adapter\MemberInterface $member |
18 | 18 | */ |
19 | - public function __construct(MemberInterface $member) |
|
20 | - { |
|
19 | + public function __construct(MemberInterface $member) |
|
20 | + { |
|
21 | 21 | $this->member = $member; |
22 | 22 | } |
23 | 23 |
@@ -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 | */ |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace DesignPattern\Structural\FluentInterface; |
4 | 4 | |
5 | -interface FluentInterface |
|
6 | -{ |
|
5 | +interface FluentInterface |
|
6 | +{ |
|
7 | 7 | /** |
8 | 8 | * Select sentence. |
9 | 9 | * |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace DesignPattern\Structural\FluentInterface; |
4 | 4 | |
5 | -class Mysql implements FluentInterface |
|
6 | -{ |
|
5 | +class Mysql implements FluentInterface |
|
6 | +{ |
|
7 | 7 | /** |
8 | 8 | * @var array |
9 | 9 | */ |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * @return string |
24 | 24 | */ |
25 | - public function __toString() |
|
26 | - { |
|
25 | + public function __toString() |
|
26 | + { |
|
27 | 27 | return sprintf( |
28 | 28 | 'SELECT %s FROM %s WHERE %s', |
29 | 29 | implode(',', $this->fields), |