Passed
Push — master ( c4286f...5969a6 )
by Oleg
04:27
created

ConsoleResolverInjector::build()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 10
loc 10
rs 9.4285
cc 2
eloc 5
nc 2
nop 0
1
<?php /** MicroConsoleResolverInjector */
2
3
namespace Micro\Resolver;
4
5
use Micro\Base\Exception;
6
use Micro\Base\Injector;
7
8
/**
9
 * Class ConsoleResolverInjector
10
 *
11
 * @author Oleg Lunegov <[email protected]>
12
 * @link https://github.com/linpax/microphp-framework
13
 * @copyright Copyright &copy; 2013 Oleg Lunegov
14
 * @license /LICENSE
15
 * @package Micro
16
 * @subpackage Resolver
17
 * @version 1.0
18
 * @since 1.0
19
 */
20 View Code Duplication
class ConsoleResolverInjector extends Injector
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
21
{
22
    /**
23
     * @return bool
24
     * @throws Exception
25
     */
26
    public function build()
27
    {
28
        $consoleResolver = parent::get('consoleResolver');
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (get() instead of build()). Are you sure this is correct? If so, you might want to change this to $this->get().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
29
30
        if (!($consoleResolver instanceof IResolver)) {
31
            throw new Exception('Component `resolver` not configured');
32
        }
33
34
        return $consoleResolver;
35
    }
36
}