Code Duplication    Length = 12-17 lines in 2 locations

src/Runner.php 1 location

@@ 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

src/Api.php 1 location

@@ 181-192 (lines=12) @@
178
     * @param string $entry
179
     * @return bool|object
180
     */
181
    private function getFromContainer($entry)
182
    {
183
        try {
184
            if (substr($entry, 0, 1) === '#') {
185
                return $this->container->getService(substr($entry, 1));
186
            }
187
188
            return $this->container->getByType($entry);
189
        } catch (MissingServiceException $e) {
190
            return false;
191
        }
192
    }
193
}
194