@@ -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 | } |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\DataMapper; |
| 6 | 6 | |
| 7 | -class User |
|
| 8 | -{ |
|
| 7 | +class User |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var string |
| 11 | 11 | */ |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | * @param string $username |
| 23 | 23 | * @param string $email |
| 24 | 24 | */ |
| 25 | - public function __construct(string $username, string $email) |
|
| 26 | - { |
|
| 25 | + public function __construct(string $username, string $email) |
|
| 26 | + {
|
|
| 27 | 27 | $this->username = $username; |
| 28 | 28 | $this->email = $email; |
| 29 | 29 | } |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\DataMapper; |
| 6 | 6 | |
| 7 | -class UserMapper |
|
| 8 | -{ |
|
| 7 | +class UserMapper |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var \DesignPattern\Structural\DataMapper\Repository |
| 11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @param \DesignPattern\Structural\DataMapper\Repository $repository |
| 18 | 18 | */ |
| 19 | - public function __construct(Repository $repository) |
|
| 20 | - { |
|
| 19 | + public function __construct(Repository $repository) |
|
| 20 | + {
|
|
| 21 | 21 | $this->repository = $repository; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | * @return mixed |
| 30 | 30 | * @throws \InvalidArgumentException |
| 31 | 31 | */ |
| 32 | - public function findById(int $id) |
|
| 33 | - { |
|
| 32 | + public function findById(int $id) |
|
| 33 | + {
|
|
| 34 | 34 | $result = $this->repository->find($id); |
| 35 | 35 | |
| 36 | - if ($result === null) { |
|
| 36 | + if ($result === null) {
|
|
| 37 | 37 | throw new \InvalidArgumentException("User #$id not found.", $id); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\Decorator; |
| 6 | 6 | |
| 7 | -class Webservice implements RenderableInterface |
|
| 8 | -{ |
|
| 7 | +class Webservice implements RenderableInterface |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var string |
| 11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @param string $data |
| 18 | 18 | */ |
| 19 | - public function __construct(string $data) |
|
| 20 | - { |
|
| 19 | + public function __construct(string $data) |
|
| 20 | + {
|
|
| 21 | 21 | $this->data = $data; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | namespace DesignPattern\Structural\Decorator; |
| 6 | 6 | |
| 7 | -abstract class RendererDecorator |
|
| 8 | -{ |
|
| 7 | +abstract class RendererDecorator |
|
| 8 | +{
|
|
| 9 | 9 | /** |
| 10 | 10 | * @var \DesignPattern\Structural\Decorator\RenderableInterface |
| 11 | 11 | */ |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @param \DesignPattern\Structural\Decorator\RenderableInterface $renderable |
| 18 | 18 | */ |
| 19 | - public function __construct(RenderableInterface $renderable) |
|
| 20 | - { |
|
| 19 | + public function __construct(RenderableInterface $renderable) |
|
| 20 | + {
|
|
| 21 | 21 | $this->renderable = $renderable; |
| 22 | 22 | } |
| 23 | 23 | } |
@@ -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 | |
@@ -15,6 +15,6 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function format(string $string): string |
| 17 | 17 | { |
| 18 | - return date('Y-m-d', (int)$string); |
|
| 18 | + return date('Y-m-d', (int) $string); |
|
| 19 | 19 | } |
| 20 | 20 | } |