| @@ 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 | ||
| @@ 173-184 (lines=12) @@ | ||
| 170 | * @param string $entry |
|
| 171 | * @return bool|object |
|
| 172 | */ |
|
| 173 | private function getFromContainer($entry) |
|
| 174 | { |
|
| 175 | try { |
|
| 176 | if (substr($entry, 0, 1) === '#') { |
|
| 177 | return $this->container->getService(substr($entry, 1)); |
|
| 178 | } |
|
| 179 | ||
| 180 | return $this->container->getByType($entry); |
|
| 181 | } catch (MissingServiceException $e) { |
|
| 182 | return false; |
|
| 183 | } |
|
| 184 | } |
|
| 185 | } |
|
| 186 | ||