| @@ 36-48 (lines=13) @@ | ||
| 33 | * @param string $entry |
|
| 34 | * @return Closure |
|
| 35 | */ |
|
| 36 | private function getMiddleware($entry) |
|
| 37 | { |
|
| 38 | // If entry is empty return handler |
|
| 39 | if (!$entry) { |
|
| 40 | return $this->handler; |
|
| 41 | } |
|
| 42 | ||
| 43 | if (mb_substr($entry, 0, 1) === '#') { |
|
| 44 | return $this->container->getService(mb_substr($entry, 1)); |
|
| 45 | } |
|
| 46 | ||
| 47 | return $this->container->getByType($entry); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| @@ 58-74 (lines=17) @@ | ||
| 55 | * @param string $entry |
|
| 56 | * @return Closure|false |
|
| 57 | */ |
|
| 58 | private function getMiddleware($entry) |
|
| 59 | { |
|
| 60 | // If entry is empty return handler |
|
| 61 | if (!$entry) { |
|
| 62 | return $this->handler; |
|
| 63 | } |
|
| 64 | ||
| 65 | try { |
|
| 66 | if (mb_substr($entry, 0, 1) === '#') { |
|
| 67 | return $this->container->getService(mb_substr($entry, 1)); |
|
| 68 | } |
|
| 69 | ||
| 70 | return $this->container->getByType($entry); |
|
| 71 | } catch (MissingServiceException $e) { |
|
| 72 | return false; |
|
| 73 | } |
|
| 74 | } |
|
| 75 | } |
|
| 76 | ||
| @@ 165-176 (lines=12) @@ | ||
| 162 | * @param string $entry |
|
| 163 | * @return bool|object |
|
| 164 | */ |
|
| 165 | private function getFromContainer($entry) |
|
| 166 | { |
|
| 167 | try { |
|
| 168 | if (substr($entry, 0, 1) === '#') { |
|
| 169 | return $this->container->getService(substr($entry, 1)); |
|
| 170 | } |
|
| 171 | ||
| 172 | return $this->container->getByType($entry); |
|
| 173 | } catch (MissingServiceException $e) { |
|
| 174 | return false; |
|
| 175 | } |
|
| 176 | } |
|
| 177 | } |
|
| 178 | ||