Code Duplication    Length = 12-17 lines in 3 locations

src/Middleware/Runner.php 1 location

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

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

@@ 159-170 (lines=12) @@
156
     * @param string $entry
157
     * @return bool|object
158
     */
159
    private function getFromContainer($entry)
160
    {
161
        try {
162
            if (substr($entry, 0, 1) === '#') {
163
                return $this->container->getService(substr($entry, 1));
164
            }
165
166
            return $this->container->getByType($entry);
167
        } catch (MissingServiceException $e) {
168
            return false;
169
        }
170
    }
171
}
172