Test Setup Failed
Push — master ( 0a3e88...820bc9 )
by Christopher
04:41
created

ResourceComplexType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 13 13 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
2
3
namespace POData\Providers\Metadata;
4
5
use AlgoWeb\ODataMetadata\MetadataV3\edm\TComplexTypeType;
6
7 View Code Duplication
class ResourceComplexType extends ResourceType
8
{
9
    /**
10
     * Create new instance of ResourceComplexType.
11
     * @param \ReflectionClass      $instanceType   Instance type for the complex type
12
     * @param TComplexTypeType      $complex        Object containing complex type metadata
13
     *
14
     * @throws \InvalidArgumentException
15
     */
16
    public function __construct(\ReflectionClass $instanceType, TComplexTypeType $complex)
17
    {
18
        $resourceTypeKind = ResourceTypeKind::COMPLEX;
19
        $bitz = explode('.', $complex->getName());
20
        $name = array_pop($bitz);
21
        $namespaceName = null;
22
        if (0 < count($bitz)) {
23
            $namespaceName = implode('.', $bitz);
24
        }
25
        $baseType = null;
26
        $isAbstract = false;
27
        parent::__construct($instanceType, $resourceTypeKind, $name, $namespaceName, $baseType, $isAbstract);
28
    }
29
}
30