Completed
Push — sam-rework ( 1696e6 )
by Andrii
38:13 queued 23:11
created

Factory::ensure()   C

Complexity

Conditions 14
Paths 16

Size

Total Lines 52
Code Lines 33

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 33
dl 0
loc 52
rs 6.2666
c 0
b 0
f 0
cc 14
nc 16
nop 2

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * @link http://www.yiiframework.com/
4
 * @copyright Copyright (c) 2008 Yii Software LLC
5
 * @license http://www.yiiframework.com/license/
6
 */
7
8
namespace yii\di;
9
10
use yii\di\exceptions\InvalidConfigException;
11
12
class Factory extends Container implements FactoryInterface
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public function create($config, array $params = [])
18
    {
19
        $definition = Definition::normalize($config);
20
        return $definition->resolve($this);
21
    }
22
}
23