| 170 | | * Returns true if the parameter name is defined (implements the ArrayAccess interface). |
|---|
| 171 | | * |
|---|
| 172 | | * @param string The parameter name |
|---|
| 173 | | * |
|---|
| 174 | | * @return Boolean true if the parameter name is defined, false otherwise |
|---|
| 175 | | */ |
|---|
| 176 | | public function offsetExists($name) |
|---|
| 177 | | { |
|---|
| 178 | | return $this->hasParameter($name); |
|---|
| 179 | | } |
|---|
| 180 | | |
|---|
| 181 | | /** |
|---|
| 182 | | * Gets a service container parameter (implements the ArrayAccess interface). |
|---|
| 183 | | * |
|---|
| 184 | | * @param string The parameter name |
|---|
| 185 | | * |
|---|
| 186 | | * @return mixed The parameter value |
|---|
| 187 | | */ |
|---|
| 188 | | public function offsetGet($name) |
|---|
| 189 | | { |
|---|
| 190 | | return $this->getParameter($name); |
|---|
| 191 | | } |
|---|
| 192 | | |
|---|
| 193 | | /** |
|---|
| 194 | | * Sets a parameter (implements the ArrayAccess interface). |
|---|
| 195 | | * |
|---|
| 196 | | * @param string The parameter name |
|---|
| 197 | | * @param mixed The parameter value |
|---|
| 198 | | */ |
|---|
| 199 | | public function offsetSet($name, $value) |
|---|
| 200 | | { |
|---|
| 201 | | $this->setParameter($name, $value); |
|---|
| 202 | | } |
|---|
| 203 | | |
|---|
| 204 | | /** |
|---|
| 205 | | * Removes a parameter (implements the ArrayAccess interface). |
|---|
| 206 | | * |
|---|
| 207 | | * @param string The parameter name |
|---|
| 208 | | */ |
|---|
| 209 | | public function offsetUnset($name) |
|---|
| 210 | | { |
|---|
| 211 | | unset($this->parameters[$name]); |
|---|
| 212 | | } |
|---|
| 213 | | |
|---|
| 214 | | /** |
|---|
| 215 | | * Returns true if the container has a service with the given identifier. |
|---|
| 216 | | * |
|---|
| 217 | | * @param string The service identifier |
|---|
| 218 | | * |
|---|
| 219 | | * @return Boolean true if the container has a service with the given identifier, false otherwise |
|---|
| 220 | | */ |
|---|
| 221 | | public function __isset($id) |
|---|
| 222 | | { |
|---|
| 223 | | return $this->hasService($id); |
|---|
| 224 | | } |
|---|
| 225 | | |
|---|
| 226 | | /** |
|---|
| 227 | | * Gets the service associated with the given identifier. |
|---|
| 228 | | * |
|---|
| 229 | | * @param string The service identifier |
|---|
| 230 | | * |
|---|
| 231 | | * @return mixed The service instance associated with the given identifier |
|---|
| 232 | | */ |
|---|
| 233 | | public function __get($id) |
|---|
| 234 | | { |
|---|
| 235 | | return $this->getService($id); |
|---|
| 236 | | } |
|---|
| 237 | | |
|---|
| 238 | | /** |
|---|
| 239 | | * Sets a service. |
|---|
| 240 | | * |
|---|
| 241 | | * @param string The service identifier |
|---|
| 242 | | * @param mixed A service instance |
|---|
| 243 | | */ |
|---|
| 244 | | public function __set($id, $service) |
|---|
| 245 | | { |
|---|
| 246 | | $this->setService($id, $service); |
|---|
| 247 | | } |
|---|
| 248 | | |
|---|
| 249 | | /** |
|---|
| 250 | | * Removes a service by identifier. |
|---|
| 251 | | * |
|---|
| 252 | | * @param string The service identifier |
|---|
| 253 | | */ |
|---|
| 254 | | public function __unset($id) |
|---|
| 255 | | { |
|---|
| 256 | | throw new LogicException('You can\'t unset a service.'); |
|---|
| 257 | | } |
|---|
| 258 | | |
|---|
| 259 | | /** |
|---|
| 260 | | * Resets the service identifiers array to the beginning (implements the Iterator interface). |
|---|
| 261 | | */ |
|---|
| 262 | | public function rewind() |
|---|
| | 170 | * Gets all services. |
|---|
| | 171 | * |
|---|
| | 172 | * Calling this method should be avoided as it creates all the services |
|---|
| | 173 | * defined for this service container. |
|---|
| | 174 | * |
|---|
| | 175 | * It is mostly useful for testing purpose. |
|---|
| | 176 | * |
|---|
| | 177 | * @return array An array of services |
|---|
| | 178 | */ |
|---|
| | 179 | public function getServices() |
|---|
| 274 | | $this->allServices = array_merge($services, $this->services); |
|---|
| | 191 | return array_merge($services, $this->services); |
|---|
| | 192 | } |
|---|
| | 193 | |
|---|
| | 194 | /** |
|---|
| | 195 | * Returns true if the parameter name is defined (implements the ArrayAccess interface). |
|---|
| | 196 | * |
|---|
| | 197 | * @param string The parameter name |
|---|
| | 198 | * |
|---|
| | 199 | * @return Boolean true if the parameter name is defined, false otherwise |
|---|
| | 200 | */ |
|---|
| | 201 | public function offsetExists($name) |
|---|
| | 202 | { |
|---|
| | 203 | return $this->hasParameter($name); |
|---|
| | 204 | } |
|---|
| | 205 | |
|---|
| | 206 | /** |
|---|
| | 207 | * Gets a service container parameter (implements the ArrayAccess interface). |
|---|
| | 208 | * |
|---|
| | 209 | * @param string The parameter name |
|---|
| | 210 | * |
|---|
| | 211 | * @return mixed The parameter value |
|---|
| | 212 | */ |
|---|
| | 213 | public function offsetGet($name) |
|---|
| | 214 | { |
|---|
| | 215 | return $this->getParameter($name); |
|---|
| | 216 | } |
|---|
| | 217 | |
|---|
| | 218 | /** |
|---|
| | 219 | * Sets a parameter (implements the ArrayAccess interface). |
|---|
| | 220 | * |
|---|
| | 221 | * @param string The parameter name |
|---|
| | 222 | * @param mixed The parameter value |
|---|
| | 223 | */ |
|---|
| | 224 | public function offsetSet($name, $value) |
|---|
| | 225 | { |
|---|
| | 226 | $this->setParameter($name, $value); |
|---|
| | 227 | } |
|---|
| | 228 | |
|---|
| | 229 | /** |
|---|
| | 230 | * Removes a parameter (implements the ArrayAccess interface). |
|---|
| | 231 | * |
|---|
| | 232 | * @param string The parameter name |
|---|
| | 233 | */ |
|---|
| | 234 | public function offsetUnset($name) |
|---|
| | 235 | { |
|---|
| | 236 | unset($this->parameters[$name]); |
|---|
| | 237 | } |
|---|
| | 238 | |
|---|
| | 239 | /** |
|---|
| | 240 | * Returns true if the container has a service with the given identifier. |
|---|
| | 241 | * |
|---|
| | 242 | * @param string The service identifier |
|---|
| | 243 | * |
|---|
| | 244 | * @return Boolean true if the container has a service with the given identifier, false otherwise |
|---|
| | 245 | */ |
|---|
| | 246 | public function __isset($id) |
|---|
| | 247 | { |
|---|
| | 248 | return $this->hasService($id); |
|---|
| | 249 | } |
|---|
| | 250 | |
|---|
| | 251 | /** |
|---|
| | 252 | * Gets the service associated with the given identifier. |
|---|
| | 253 | * |
|---|
| | 254 | * @param string The service identifier |
|---|
| | 255 | * |
|---|
| | 256 | * @return mixed The service instance associated with the given identifier |
|---|
| | 257 | */ |
|---|
| | 258 | public function __get($id) |
|---|
| | 259 | { |
|---|
| | 260 | return $this->getService($id); |
|---|
| | 261 | } |
|---|
| | 262 | |
|---|
| | 263 | /** |
|---|
| | 264 | * Sets a service. |
|---|
| | 265 | * |
|---|
| | 266 | * @param string The service identifier |
|---|
| | 267 | * @param mixed A service instance |
|---|
| | 268 | */ |
|---|
| | 269 | public function __set($id, $service) |
|---|
| | 270 | { |
|---|
| | 271 | $this->setService($id, $service); |
|---|
| | 272 | } |
|---|
| | 273 | |
|---|
| | 274 | /** |
|---|
| | 275 | * Removes a service by identifier. |
|---|
| | 276 | * |
|---|
| | 277 | * @param string The service identifier |
|---|
| | 278 | */ |
|---|
| | 279 | public function __unset($id) |
|---|
| | 280 | { |
|---|
| | 281 | throw new LogicException('You can\'t unset a service.'); |
|---|
| | 282 | } |
|---|
| | 283 | |
|---|
| | 284 | /** |
|---|
| | 285 | * Resets the service identifiers array to the beginning (implements the Iterator interface). |
|---|
| | 286 | */ |
|---|
| | 287 | public function rewind() |
|---|
| | 288 | { |
|---|
| | 289 | $this->allServices = $this->getServices(); |
|---|