@@ -32,8 +32,7 @@ |
||
| 32 | 32 | * @author Fabien Potencier |
| 33 | 33 | * @author Dominik Zogg |
| 34 | 34 | */ |
| 35 | -interface ServiceProviderInterface |
|
| 36 | -{ |
|
| 35 | +interface ServiceProviderInterface { |
|
| 37 | 36 | /** |
| 38 | 37 | * Registers services on the given container. |
| 39 | 38 | * |
@@ -31,8 +31,7 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @author Fabien Potencier |
| 33 | 33 | */ |
| 34 | -class Container implements \ArrayAccess |
|
| 35 | -{ |
|
| 34 | +class Container implements \ArrayAccess { |
|
| 36 | 35 | private $values = array(); |
| 37 | 36 | private $factories; |
| 38 | 37 | private $protected; |
@@ -47,8 +46,7 @@ discard block |
||
| 47 | 46 | * |
| 48 | 47 | * @param array $values The parameters or objects. |
| 49 | 48 | */ |
| 50 | - public function __construct(array $values = array()) |
|
| 51 | - { |
|
| 49 | + public function __construct(array $values = array()) { |
|
| 52 | 50 | $this->factories = new \SplObjectStorage(); |
| 53 | 51 | $this->protected = new \SplObjectStorage(); |
| 54 | 52 | |
@@ -71,8 +69,7 @@ discard block |
||
| 71 | 69 | * |
| 72 | 70 | * @throws \RuntimeException Prevent override of a frozen service |
| 73 | 71 | */ |
| 74 | - public function offsetSet($id, $value) |
|
| 75 | - { |
|
| 72 | + public function offsetSet($id, $value) { |
|
| 76 | 73 | if (isset($this->frozen[$id])) { |
| 77 | 74 | throw new \RuntimeException(sprintf('Cannot override frozen service "%s".', $id)); |
| 78 | 75 | } |
@@ -90,8 +87,7 @@ discard block |
||
| 90 | 87 | * |
| 91 | 88 | * @throws \InvalidArgumentException if the identifier is not defined |
| 92 | 89 | */ |
| 93 | - public function offsetGet($id) |
|
| 94 | - { |
|
| 90 | + public function offsetGet($id) { |
|
| 95 | 91 | if (!isset($this->keys[$id])) { |
| 96 | 92 | throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); |
| 97 | 93 | } |
@@ -125,8 +121,7 @@ discard block |
||
| 125 | 121 | * |
| 126 | 122 | * @return bool |
| 127 | 123 | */ |
| 128 | - public function offsetExists($id) |
|
| 129 | - { |
|
| 124 | + public function offsetExists($id) { |
|
| 130 | 125 | return isset($this->keys[$id]); |
| 131 | 126 | } |
| 132 | 127 | |
@@ -135,8 +130,7 @@ discard block |
||
| 135 | 130 | * |
| 136 | 131 | * @param string $id The unique identifier for the parameter or object |
| 137 | 132 | */ |
| 138 | - public function offsetUnset($id) |
|
| 139 | - { |
|
| 133 | + public function offsetUnset($id) { |
|
| 140 | 134 | if (isset($this->keys[$id])) { |
| 141 | 135 | if (is_object($this->values[$id])) { |
| 142 | 136 | unset($this->factories[$this->values[$id]], $this->protected[$this->values[$id]]); |
@@ -155,8 +149,7 @@ discard block |
||
| 155 | 149 | * |
| 156 | 150 | * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object |
| 157 | 151 | */ |
| 158 | - public function factory($callable) |
|
| 159 | - { |
|
| 152 | + public function factory($callable) { |
|
| 160 | 153 | if (!method_exists($callable, '__invoke')) { |
| 161 | 154 | throw new \InvalidArgumentException('Service definition is not a Closure or invokable object.'); |
| 162 | 155 | } |
@@ -177,8 +170,7 @@ discard block |
||
| 177 | 170 | * |
| 178 | 171 | * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object |
| 179 | 172 | */ |
| 180 | - public function protect($callable) |
|
| 181 | - { |
|
| 173 | + public function protect($callable) { |
|
| 182 | 174 | if (!method_exists($callable, '__invoke')) { |
| 183 | 175 | throw new \InvalidArgumentException('Callable is not a Closure or invokable object.'); |
| 184 | 176 | } |
@@ -197,8 +189,7 @@ discard block |
||
| 197 | 189 | * |
| 198 | 190 | * @throws \InvalidArgumentException if the identifier is not defined |
| 199 | 191 | */ |
| 200 | - public function raw($id) |
|
| 201 | - { |
|
| 192 | + public function raw($id) { |
|
| 202 | 193 | if (!isset($this->keys[$id])) { |
| 203 | 194 | throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); |
| 204 | 195 | } |
@@ -223,8 +214,7 @@ discard block |
||
| 223 | 214 | * |
| 224 | 215 | * @throws \InvalidArgumentException if the identifier is not defined or not a service definition |
| 225 | 216 | */ |
| 226 | - public function extend($id, $callable) |
|
| 227 | - { |
|
| 217 | + public function extend($id, $callable) { |
|
| 228 | 218 | if (!isset($this->keys[$id])) { |
| 229 | 219 | throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); |
| 230 | 220 | } |
@@ -256,8 +246,7 @@ discard block |
||
| 256 | 246 | * |
| 257 | 247 | * @return array An array of value names |
| 258 | 248 | */ |
| 259 | - public function keys() |
|
| 260 | - { |
|
| 249 | + public function keys() { |
|
| 261 | 250 | return array_keys($this->values); |
| 262 | 251 | } |
| 263 | 252 | |
@@ -269,8 +258,7 @@ discard block |
||
| 269 | 258 | * |
| 270 | 259 | * @return static |
| 271 | 260 | */ |
| 272 | - public function register(ServiceProviderInterface $provider, array $values = array()) |
|
| 273 | - { |
|
| 261 | + public function register(ServiceProviderInterface $provider, array $values = array()) { |
|
| 274 | 262 | $provider->register($this); |
| 275 | 263 | |
| 276 | 264 | foreach ($values as $key => $value) { |
@@ -26,7 +26,9 @@ |
||
| 26 | 26 | * DO NOT CHANGE |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | -if (!defined('INSIDE')) die(); |
|
| 29 | +if (!defined('INSIDE')) { |
|
| 30 | + die(); |
|
| 31 | +} |
|
| 30 | 32 | |
| 31 | 33 | |
| 32 | 34 | $a_lang_array = (array( |
@@ -26,7 +26,9 @@ |
||
| 26 | 26 | * DO NOT CHANGE |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | -if (!defined('INSIDE')) die(); |
|
| 29 | +if (!defined('INSIDE')) { |
|
| 30 | + die(); |
|
| 31 | +} |
|
| 30 | 32 | |
| 31 | 33 | |
| 32 | 34 | $a_lang_array = (array( |
@@ -26,7 +26,9 @@ |
||
| 26 | 26 | * DO NOT CHANGE |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | -if (!defined('INSIDE')) die(); |
|
| 29 | +if (!defined('INSIDE')) { |
|
| 30 | + die(); |
|
| 31 | +} |
|
| 30 | 32 | |
| 31 | 33 | |
| 32 | 34 | $a_lang_array = (array( |
@@ -26,7 +26,9 @@ |
||
| 26 | 26 | * DO NOT CHANGE |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | -if (!defined('INSIDE')) die(); |
|
| 29 | +if (!defined('INSIDE')) { |
|
| 30 | + die(); |
|
| 31 | +} |
|
| 30 | 32 | |
| 31 | 33 | |
| 32 | 34 | $a_lang_array = (array( |
@@ -26,7 +26,9 @@ |
||
| 26 | 26 | * DO NOT CHANGE |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | -if (!defined('INSIDE')) die(); |
|
| 29 | +if (!defined('INSIDE')) { |
|
| 30 | + die(); |
|
| 31 | +} |
|
| 30 | 32 | |
| 31 | 33 | |
| 32 | 34 | $a_lang_array = array( |
@@ -26,7 +26,9 @@ |
||
| 26 | 26 | * DO NOT CHANGE |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | -if (!defined('INSIDE')) die(); |
|
| 29 | +if (!defined('INSIDE')) { |
|
| 30 | + die(); |
|
| 31 | +} |
|
| 30 | 32 | |
| 31 | 33 | |
| 32 | 34 | $a_lang_array = array( |
@@ -26,7 +26,9 @@ |
||
| 26 | 26 | * DO NOT CHANGE |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | -if (!defined('INSIDE')) die(); |
|
| 29 | +if (!defined('INSIDE')) { |
|
| 30 | + die(); |
|
| 31 | +} |
|
| 30 | 32 | |
| 31 | 33 | |
| 32 | 34 | $a_lang_array = (array( |