@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\Flyweight; |
| 6 | 6 | |
| 7 | -class Gun |
|
| 8 | -{ |
|
| 7 | +class Gun |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var array|BulletInterface[] |
| 11 | 11 | */ |
@@ -21,8 +21,8 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param int $maxBullets |
| 23 | 23 | */ |
| 24 | - public function __construct(int $maxBullets) |
|
| 25 | - { |
|
| 24 | + public function __construct(int $maxBullets) |
|
| 25 | + {
|
|
| 26 | 26 | $this->bullets = []; |
| 27 | 27 | $this->maxBullets = $maxBullets; |
| 28 | 28 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | public function reload(string $type): void |
| 52 | 52 | { |
| 53 | 53 | $count = count($this->bullets); |
| 54 | - for (; $count < $this->maxBullets; $count++) { |
|
| 54 | + for (; $count < $this->maxBullets; $count++) {
|
|
| 55 | 55 | $this->bullets[] = BulletFactory::getInstance($type); |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | public function fire(): string |
| 63 | 63 | { |
| 64 | - if ($count = count($this->bullets)) { |
|
| 64 | + if ($count = count($this->bullets)) {
|
|
| 65 | 65 | $bullet = array_shift($this->bullets); |
| 66 | 66 | $bullet->setPositionInMagazine($this->maxBullets - $count + 1); |
| 67 | 67 | |