Code Duplication    Length = 12-17 lines in 2 locations

src/Api.php 1 location

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

src/Runner.php 1 location

@@ 59-75 (lines=17) @@
56
     * @param string $entry
57
     * @return Closure|false
58
     */
59
    private function getMiddleware($entry)
60
    {
61
        // If entry is empty return handler
62
        if (!$entry) {
63
            return $this->handler;
64
        }
65
66
        try {
67
            if (substr($entry, 0, 1) === '#') {
68
                return $this->container->getService(substr($entry, 1));
69
            }
70
71
            return $this->container->getByType($entry);
72
        } catch (MissingServiceException $e) {
73
            return false;
74
        }
75
    }
76
}
77