Code Duplication    Length = 15-15 lines in 2 locations

base/Container.php 1 location

@@ 261-275 (lines=15) @@
258
     *
259
     * @return mixed
260
     */
261
    private function makeObject($className, array $arguments = [])
262
    {
263
        try {
264
            $reflection = new \ReflectionClass($className);
265
            $reflectionMethod = new \ReflectionMethod($className, '__construct');
266
267
            if ($reflectionMethod->getNumberOfParameters() === 0) {
268
                return new $className;
269
            } else {
270
                return $reflection->newInstanceArgs($arguments);
271
            }
272
        } catch (Exception $e) {
273
            return false;
274
        }
275
    }
276
}
277

base/Injector.php 1 location

@@ 173-187 (lines=15) @@
170
     *
171
     * @return mixed
172
     */
173
    private function makeObject($className, array $arguments = [])
174
    {
175
        try {
176
            $reflection = new \ReflectionClass($className);
177
            $reflectionMethod = new \ReflectionMethod($className, '__construct');
178
179
            if ($reflectionMethod->getNumberOfParameters() === 0) {
180
                return new $className;
181
            } else {
182
                return $reflection->newInstanceArgs($arguments);
183
            }
184
        } catch (Exception $e) {
185
            return false;
186
        }
187
    }
188
}