@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\Proxy; |
| 6 | 6 | |
| 7 | -class WifiNetwork implements WifiNetworkInterface |
|
| 8 | -{ |
|
| 7 | +class WifiNetwork implements WifiNetworkInterface |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var string |
| 11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @param string $name |
| 18 | 18 | */ |
| 19 | - public function __construct(string $name) |
|
| 20 | - { |
|
| 19 | + public function __construct(string $name) |
|
| 20 | + {
|
|
| 21 | 21 | $this->name = $name; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\Proxy; |
| 6 | 6 | |
| 7 | -class WifiNetworkProxy implements WifiNetworkInterface |
|
| 8 | -{ |
|
| 7 | +class WifiNetworkProxy implements WifiNetworkInterface |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var \DesignPattern\Structural\Proxy\WifiNetwork |
| 11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @param string $name |
| 18 | 18 | */ |
| 19 | - public function __construct(string $name) |
|
| 20 | - { |
|
| 19 | + public function __construct(string $name) |
|
| 20 | + {
|
|
| 21 | 21 | $this->wifiNetwork = new WifiNetwork($name); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function grantAccess(Employee $employee): bool |
| 32 | 32 | { |
| 33 | - if ($employee->getAccessLevel() === Employee::ACCESS_LEVEL_ALLOW) { |
|
| 33 | + if ($employee->getAccessLevel() === Employee::ACCESS_LEVEL_ALLOW) {
|
|
| 34 | 34 | return $this->wifiNetwork->grantAccess($employee); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\DependencyInjection; |
| 6 | 6 | |
| 7 | -class DepartmentStore |
|
| 8 | -{ |
|
| 7 | +class DepartmentStore |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var \DesignPattern\Structural\DependencyInjection\AbstractMap |
| 11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @param \DesignPattern\Structural\DependencyInjection\AbstractMap $mapService |
| 18 | 18 | */ |
| 19 | - public function __construct(AbstractMap $mapService) |
|
| 20 | - { |
|
| 19 | + public function __construct(AbstractMap $mapService) |
|
| 20 | + {
|
|
| 21 | 21 | $this->mapService = $mapService; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function getStoreCoordinate(string $address): string |
| 34 | 34 | { |
| 35 | - if (empty($address)) { |
|
| 35 | + if (empty($address)) {
|
|
| 36 | 36 | throw new \InvalidArgumentException('Please enter the address.'); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\Bridge; |
| 6 | 6 | |
| 7 | -abstract class Service |
|
| 8 | -{ |
|
| 7 | +abstract class Service |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var \DesignPattern\Structural\Bridge\FormatterInterface |
| 11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @param \DesignPattern\Structural\Bridge\FormatterInterface $formatter |
| 18 | 18 | */ |
| 19 | - public function __construct(FormatterInterface $formatter) |
|
| 20 | - { |
|
| 19 | + public function __construct(FormatterInterface $formatter) |
|
| 20 | + {
|
|
| 21 | 21 | $this->formatter = $formatter; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -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 @@ 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 | |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\Flyweight; |
| 6 | 6 | |
| 7 | -interface BulletInterface |
|
| 8 | -{ |
|
| 7 | +interface BulletInterface |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @param int $position |
| 11 | 11 | */ |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\Facade; |
| 6 | 6 | |
| 7 | -class Facade |
|
| 8 | -{ |
|
| 7 | +class Facade |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var \DesignPattern\Structural\Facade\BiosInterface |
| 11 | 11 | */ |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | * @param \DesignPattern\Structural\Facade\BiosInterface $bios |
| 23 | 23 | * @param \DesignPattern\Structural\Facade\MacOSInterface $macOS |
| 24 | 24 | */ |
| 25 | - public function __construct(BiosInterface $bios, MacOSInterface $macOS) |
|
| 26 | - { |
|
| 25 | + public function __construct(BiosInterface $bios, MacOSInterface $macOS) |
|
| 26 | + {
|
|
| 27 | 27 | $this->bios = $bios; |
| 28 | 28 | $this->macOS = $macOS; |
| 29 | 29 | } |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\Composite; |
| 6 | 6 | |
| 7 | -class InputElement implements RenderableInterface |
|
| 8 | -{ |
|
| 7 | +class InputElement implements RenderableInterface |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var string |
| 11 | 11 | */ |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | * @param string $name |
| 23 | 23 | * @param string $type |
| 24 | 24 | */ |
| 25 | - public function __construct(string $name, string $type = 'text') |
|
| 26 | - { |
|
| 25 | + public function __construct(string $name, string $type = 'text') |
|
| 26 | + {
|
|
| 27 | 27 | $this->name = $name; |
| 28 | 28 | $this->type = $type; |
| 29 | 29 | } |