Passed
Push — master ( f3fcaa...2db009 )
by Oleg
04:04
created

ResolverInjector   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 2
c 1
b 1
f 0
lcom 0
cbo 2
dl 17
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 10 10 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php /** MicroResolverInjector */
2
3
namespace Micro\Resolver;
4
5
use Micro\Base\Exception;
6
use Micro\Base\Injector;
7
8
/**
9
 * Class ResolverInjector
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 ResolverInjector 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 get()
27
    {
28
        $resolver = parent::get('resolver');
29
30
        if (!($resolver instanceof IResolver)) {
31
            throw new Exception('Component `resolver` not configured');
32
        }
33
34
        return $resolver;
35
    }
36
}