@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\DataMapper; |
| 6 | 6 | |
| 7 | -class Repository |
|
| 8 | -{ |
|
| 7 | +class Repository |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var array |
| 11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @param array $data |
| 18 | 18 | */ |
| 19 | - public function __construct(array $data) |
|
| 20 | - { |
|
| 19 | + public function __construct(array $data) |
|
| 20 | + {
|
|
| 21 | 21 | $this->data = $data; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @return mixed|null |
| 30 | 30 | */ |
| 31 | - public function find(int $id) |
|
| 32 | - { |
|
| 31 | + public function find(int $id) |
|
| 32 | + {
|
|
| 33 | 33 | return $this->data[$id] ?? null; |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -2,8 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace DesignPattern\Structural\Proxy; |
| 4 | 4 | |
| 5 | -interface WifiNetworkInterface |
|
| 6 | -{ |
|
| 5 | +interface WifiNetworkInterface |
|
| 6 | +{
|
|
| 7 | 7 | /** |
| 8 | 8 | * Grant access to the Wifi network to an employee. |
| 9 | 9 | * |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | namespace DesignPattern\Structural\Proxy; |
| 4 | 4 | |
| 5 | -class WifiNetworkProxy implements WifiNetworkInterface |
|
| 6 | -{ |
|
| 5 | +class WifiNetworkProxy implements WifiNetworkInterface |
|
| 6 | +{
|
|
| 7 | 7 | /** |
| 8 | 8 | * @var \DesignPattern\Structural\Proxy\WifiNetwork |
| 9 | 9 | */ |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | * |
| 15 | 15 | * @param string $name |
| 16 | 16 | */ |
| 17 | - public function __construct(string $name) |
|
| 18 | - { |
|
| 17 | + public function __construct(string $name) |
|
| 18 | + {
|
|
| 19 | 19 | $this->wifiNetwork = new WifiNetwork($name); |
| 20 | 20 | } |
| 21 | 21 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function grantAccess(Employee $employee): bool |
| 30 | 30 | { |
| 31 | - if ($employee->getAccessLevel() === Employee::ACCESS_LEVEL_ALLOW) { |
|
| 31 | + if ($employee->getAccessLevel() === Employee::ACCESS_LEVEL_ALLOW) {
|
|
| 32 | 32 | return $this->wifiNetwork->grantAccess($employee); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | namespace DesignPattern\Structural\Proxy; |
| 4 | 4 | |
| 5 | -class Employee |
|
| 6 | -{ |
|
| 5 | +class Employee |
|
| 6 | +{
|
|
| 7 | 7 | /** |
| 8 | 8 | * No access to WiFi. |
| 9 | 9 | */ |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | string $username, |
| 41 | 41 | string $password, |
| 42 | 42 | int $accessLevel |
| 43 | - ) { |
|
| 43 | + ) {
|
|
| 44 | 44 | $this->username = $username; |
| 45 | 45 | $this->password = $password; |
| 46 | 46 | $this->accessLevel = $accessLevel; |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | namespace DesignPattern\Structural\Proxy; |
| 4 | 4 | |
| 5 | -class WifiNetwork implements WifiNetworkInterface |
|
| 6 | -{ |
|
| 5 | +class WifiNetwork implements WifiNetworkInterface |
|
| 6 | +{
|
|
| 7 | 7 | /** |
| 8 | 8 | * @var string |
| 9 | 9 | */ |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | * |
| 15 | 15 | * @param string $name |
| 16 | 16 | */ |
| 17 | - public function __construct(string $name) |
|
| 18 | - { |
|
| 17 | + public function __construct(string $name) |
|
| 18 | + {
|
|
| 19 | 19 | $this->name = $name; |
| 20 | 20 | } |
| 21 | 21 | |
@@ -2,8 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace DesignPattern\Structural\Facade; |
| 4 | 4 | |
| 5 | -interface MacOSInterface |
|
| 6 | -{ |
|
| 5 | +interface MacOSInterface |
|
| 6 | +{
|
|
| 7 | 7 | public function restart(); |
| 8 | 8 | |
| 9 | 9 | public function shutdown(); |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | namespace DesignPattern\Structural\Facade; |
| 4 | 4 | |
| 5 | -class Facade |
|
| 6 | -{ |
|
| 5 | +class Facade |
|
| 6 | +{
|
|
| 7 | 7 | /** |
| 8 | 8 | * @var \DesignPattern\Structural\Facade\BiosInterface |
| 9 | 9 | */ |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | * @param \DesignPattern\Structural\Facade\BiosInterface $bios |
| 21 | 21 | * @param \DesignPattern\Structural\Facade\MacOSInterface $macOS |
| 22 | 22 | */ |
| 23 | - public function __construct(BiosInterface $bios, MacOSInterface $macOS) |
|
| 24 | - { |
|
| 23 | + public function __construct(BiosInterface $bios, MacOSInterface $macOS) |
|
| 24 | + {
|
|
| 25 | 25 | $this->bios = $bios; |
| 26 | 26 | $this->macOS = $macOS; |
| 27 | 27 | } |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | namespace DesignPattern\Structural\Facade; |
| 4 | 4 | |
| 5 | -class Bios implements BiosInterface |
|
| 6 | -{ |
|
| 5 | +class Bios implements BiosInterface |
|
| 6 | +{
|
|
| 7 | 7 | /** |
| 8 | 8 | * @return string |
| 9 | 9 | */ |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | * |
| 18 | 18 | * @return mixed |
| 19 | 19 | */ |
| 20 | - public function launch(MacOSInterface $macOS) |
|
| 21 | - { |
|
| 20 | + public function launch(MacOSInterface $macOS) |
|
| 21 | + {
|
|
| 22 | 22 | return $macOS->launch(); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -2,8 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace DesignPattern\Structural\Facade; |
| 4 | 4 | |
| 5 | -interface BiosInterface |
|
| 6 | -{ |
|
| 5 | +interface BiosInterface |
|
| 6 | +{
|
|
| 7 | 7 | public function execute(); |
| 8 | 8 | |
| 9 | 9 | /** |