@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | /** Init the scope storage. Get the underlying storage implementation from factory method */ |
14 | 14 | protected function initGlobal() { |
15 | 15 | $impl = $this->fromMethod(self::DI_GLOBAL_STORAGE_KEY); |
16 | - if ($impl === null) |
|
17 | - throw new StorageFactoryNotDefined(self::DI_SESSION_STORAGE_KEY); |
|
16 | + if ($impl === null) { |
|
17 | + throw new StorageFactoryNotDefined(self::DI_SESSION_STORAGE_KEY); |
|
18 | + } |
|
18 | 19 | |
19 | 20 | $this->globalStorage = new OfflineStorageAdapter($impl->value); |
20 | 21 | } |
@@ -36,8 +37,9 @@ discard block |
||
36 | 37 | * @return mixed Stored value from the supplied bean. |
37 | 38 | */ |
38 | 39 | protected function toGlobal(Bean $bean) { |
39 | - if ($bean->scope === Bean::SCOPE_GLOBAL || $bean->value instanceof GlobalScope) |
|
40 | - return $this->globalStorage->store($bean); |
|
40 | + if ($bean->scope === Bean::SCOPE_GLOBAL || $bean->value instanceof GlobalScope) { |
|
41 | + return $this->globalStorage->store($bean); |
|
42 | + } |
|
41 | 43 | |
42 | 44 | return null; |
43 | 45 | } |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | /** Init the scope storage. Get the underlying storage implementation from factory method */ |
14 | 14 | protected function initSession() { |
15 | 15 | $impl = $this->fromMethod(self::DI_SESSION_STORAGE_KEY); |
16 | - if ($impl === null) |
|
17 | - throw new StorageFactoryNotDefined(self::DI_SESSION_STORAGE_KEY); |
|
16 | + if ($impl === null) { |
|
17 | + throw new StorageFactoryNotDefined(self::DI_SESSION_STORAGE_KEY); |
|
18 | + } |
|
18 | 19 | |
19 | 20 | $this->sessionStorage = new OfflineStorageAdapter($impl->value); |
20 | 21 | } |
@@ -36,8 +37,9 @@ discard block |
||
36 | 37 | * @return mixed Stored value from the supplied bean. |
37 | 38 | */ |
38 | 39 | protected function toSession(Bean $bean) { |
39 | - if ($bean->scope === Bean::SCOPE_SESSION || $bean->value instanceof SessionScope) |
|
40 | - return $this->sessionStorage->store($bean); |
|
40 | + if ($bean->scope === Bean::SCOPE_SESSION || $bean->value instanceof SessionScope) { |
|
41 | + return $this->sessionStorage->store($bean); |
|
42 | + } |
|
41 | 43 | |
42 | 44 | return null; |
43 | 45 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | */ |
44 | 44 | public function store(Bean $bean) { |
45 | 45 | $this->storage->store(self::DI_VALUE_PREFIX.$bean->name, $bean->value); |
46 | - foreach($bean->aliases as $alias) |
|
46 | + foreach ($bean->aliases as $alias) |
|
47 | 47 | $this->storage->store(self::DI_ALIAS_PREFIX.$alias, $bean->name); |
48 | 48 | |
49 | 49 | return $bean->value; |
@@ -25,12 +25,14 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function fetch($name) { |
27 | 27 | $value = $this->storage->fetch(self::DI_VALUE_PREFIX.$name); |
28 | - if ($value !== null) |
|
29 | - return $value; |
|
28 | + if ($value !== null) { |
|
29 | + return $value; |
|
30 | + } |
|
30 | 31 | |
31 | 32 | $alias = $this->storage->fetch(self::DI_ALIAS_PREFIX.$name); |
32 | - if ($alias !== null) |
|
33 | - return $this->storage->fetch(self::DI_VALUE_PREFIX.$alias); |
|
33 | + if ($alias !== null) { |
|
34 | + return $this->storage->fetch(self::DI_VALUE_PREFIX.$alias); |
|
35 | + } |
|
34 | 36 | |
35 | 37 | return null; |
36 | 38 | } |
@@ -43,8 +45,9 @@ discard block |
||
43 | 45 | */ |
44 | 46 | public function store(Bean $bean) { |
45 | 47 | $this->storage->store(self::DI_VALUE_PREFIX.$bean->name, $bean->value); |
46 | - foreach($bean->aliases as $alias) |
|
47 | - $this->storage->store(self::DI_ALIAS_PREFIX.$alias, $bean->name); |
|
48 | + foreach($bean->aliases as $alias) { |
|
49 | + $this->storage->store(self::DI_ALIAS_PREFIX.$alias, $bean->name); |
|
50 | + } |
|
48 | 51 | |
49 | 52 | return $bean->value; |
50 | 53 | } |
@@ -27,12 +27,14 @@ |
||
27 | 27 | * @return mixed Stored value from the supplied bean. |
28 | 28 | */ |
29 | 29 | protected function toLocal(Bean $bean) { |
30 | - if ($bean->scope !== null || ($bean->value instanceof Scope)) |
|
31 | - return null; |
|
30 | + if ($bean->scope !== null || ($bean->value instanceof Scope)) { |
|
31 | + return null; |
|
32 | + } |
|
32 | 33 | |
33 | 34 | $this->storage[$bean->name] = $bean->value; |
34 | - foreach ($bean->aliases as $alias) |
|
35 | - $this->storage[$alias] = $bean->value; |
|
35 | + foreach ($bean->aliases as $alias) { |
|
36 | + $this->storage[$alias] = $bean->value; |
|
37 | + } |
|
36 | 38 | |
37 | 39 | return $bean->value; |
38 | 40 | } |
@@ -8,8 +8,9 @@ |
||
8 | 8 | { |
9 | 9 | /** Just check the precondition - APCu must be installed */ |
10 | 10 | public function __construct() { |
11 | - if (function_exists('apcu_fetch') === false) |
|
12 | - throw new ApcuNotInstalled(); |
|
11 | + if (function_exists('apcu_fetch') === false) { |
|
12 | + throw new ApcuNotInstalled(); |
|
13 | + } |
|
13 | 14 | } |
14 | 15 | |
15 | 16 | /** {@inheritdoc} */ |
@@ -8,10 +8,11 @@ |
||
8 | 8 | { |
9 | 9 | /** Just ensure the preconditions - session is active and started */ |
10 | 10 | public function __construct() { |
11 | - if (session_status() === PHP_SESSION_NONE) |
|
12 | - session_start(); |
|
13 | - else if (session_status() === PHP_SESSION_DISABLED) |
|
14 | - throw new SessionsNotEnabled(); |
|
11 | + if (session_status() === PHP_SESSION_NONE) { |
|
12 | + session_start(); |
|
13 | + } else if (session_status() === PHP_SESSION_DISABLED) { |
|
14 | + throw new SessionsNotEnabled(); |
|
15 | + } |
|
15 | 16 | } |
16 | 17 | |
17 | 18 | /** {@inheritdoc} */ |
@@ -5,8 +5,8 @@ |
||
5 | 5 | /** Is thrown when a required factory method is missing, thus providing no storage for an active scope */ |
6 | 6 | class StorageFactoryNotDefined extends \evelikto\di\DiException |
7 | 7 | { |
8 | - /** @param string $name Name of the required factory */ |
|
9 | - public function __construct(string $name) { |
|
10 | - parent::__construct(['name' => $name]); |
|
11 | - } |
|
8 | + /** @param string $name Name of the required factory */ |
|
9 | + public function __construct(string $name) { |
|
10 | + parent::__construct(['name' => $name]); |
|
11 | + } |
|
12 | 12 | } |
13 | 13 | \ No newline at end of file |
@@ -5,8 +5,8 @@ |
||
5 | 5 | /** Is thrown when autowiring of a method parameter fails */ |
6 | 6 | class UnresolvableParameter extends DiException |
7 | 7 | { |
8 | - /** @param string $name Name of the parameter. */ |
|
9 | - public function __construct(string $name) { |
|
10 | - parent::__construct(['name' => $name]); |
|
11 | - } |
|
8 | + /** @param string $name Name of the parameter. */ |
|
9 | + public function __construct(string $name) { |
|
10 | + parent::__construct(['name' => $name]); |
|
11 | + } |
|
12 | 12 | } |
13 | 13 | \ No newline at end of file |