| @@ 304-322 (lines=19) @@ | ||
| 301 | continue; |
|
| 302 | } elseif (method_exists($this, $method = 'get'.strtr($id, $this->underscoreMap).'Service')) { |
|
| 303 | // $method is set to the right value, proceed |
|
| 304 | } else { |
|
| 305 | if (self::EXCEPTION_ON_INVALID_REFERENCE === $invalidBehavior) { |
|
| 306 | if (!$id) { |
|
| 307 | throw new ServiceNotFoundException($id); |
|
| 308 | } |
|
| 309 | ||
| 310 | $alternatives = array(); |
|
| 311 | foreach ($this->services as $key => $associatedService) { |
|
| 312 | $lev = levenshtein($id, $key); |
|
| 313 | if ($lev <= strlen($id) / 3 || false !== strpos($key, $id)) { |
|
| 314 | $alternatives[] = $key; |
|
| 315 | } |
|
| 316 | } |
|
| 317 | ||
| 318 | throw new ServiceNotFoundException($id, null, null, $alternatives); |
|
| 319 | } |
|
| 320 | ||
| 321 | return; |
|
| 322 | } |
|
| 323 | ||
| 324 | $this->loading[$id] = true; |
|
| 325 | ||
| @@ 93-107 (lines=15) @@ | ||
| 90 | { |
|
| 91 | $name = strtolower($name); |
|
| 92 | ||
| 93 | if (!array_key_exists($name, $this->parameters)) { |
|
| 94 | if (!$name) { |
|
| 95 | throw new ParameterNotFoundException($name); |
|
| 96 | } |
|
| 97 | ||
| 98 | $alternatives = array(); |
|
| 99 | foreach ($this->parameters as $key => $parameterValue) { |
|
| 100 | $lev = levenshtein($name, $key); |
|
| 101 | if ($lev <= strlen($name) / 3 || false !== strpos($key, $name)) { |
|
| 102 | $alternatives[] = $key; |
|
| 103 | } |
|
| 104 | } |
|
| 105 | ||
| 106 | throw new ParameterNotFoundException($name, null, null, null, $alternatives); |
|
| 107 | } |
|
| 108 | ||
| 109 | return $this->parameters[$name]; |
|
| 110 | } |
|