Code Duplication    Length = 21-23 lines in 2 locations

src/POData/Providers/Metadata/ResourceComplexType.php 1 location

@@ 7-29 (lines=23) @@
4
5
use AlgoWeb\ODataMetadata\MetadataV3\edm\TComplexTypeType;
6
7
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

src/POData/Providers/Metadata/ResourcePrimitiveType.php 1 location

@@ 7-27 (lines=21) @@
4
5
use POData\Providers\Metadata\Type\IType;
6
7
class ResourcePrimitiveType extends ResourceType
8
{
9
    /**
10
     * Create new instance of ResourcePrimitiveType.
11
     * @param IType                 $primitive      Instance type for the primitive type
12
     *
13
     * @throws \InvalidArgumentException
14
     */
15
    public function __construct(IType $primitive)
16
    {
17
        $resourceTypeKind = ResourceTypeKind::PRIMITIVE;
18
        $bitz = explode('.', $primitive->getName());
19
        $name = array_pop($bitz);
20
        $namespaceName = null;
21
        if (0 < count($bitz)) {
22
            $namespaceName = implode('.', $bitz);
23
        }
24
        $baseType = null;
25
        $isAbstract = false;
26
        parent::__construct($primitive, $resourceTypeKind, $name, $namespaceName, $baseType, $isAbstract);
27
    }
28
}
29