ObjectManager::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 2
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Copyright © 2017 Toan Nguyen. All rights reserved.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Gojira\Framework\ObjectManager;
10
11
class ObjectManager implements ObjectManagerInterface
12
{
13
    /**
14
     * Create new object instance
15
     *
16
     * @param string $type
17
     * @param array  $arguments
18
     *
19
     * @return mixed
20
     */
21
    public static function create($type, array $arguments = [])
22
    {
23
        $type = ltrim($type, '\\');
24
        return call_user_func_array(
25
            [new \ReflectionClass($type), 'newInstance'],
26
            $arguments
27
        );
28
    }
29
}
30