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

ResourceEntityType   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 3
1
<?php
2
3
namespace POData\Providers\Metadata;
4
5
use AlgoWeb\ODataMetadata\MetadataV3\edm\TEntityTypeType;
6
7
class ResourceEntityType extends ResourceType
8
{
9
    /**
10
     * Create new instance of ResourceEntityType.
11
     * @param \ReflectionClass              $instanceType   Instance type for the entity type
12
     * @param TEntityTypeType               $entity         Object containing complex type metadata
13
     * @param IMetadataProvider             $meta           Application's metadata provider
14
     *
15
     * @throws \InvalidArgumentException
16
     */
17
    public function __construct(\ReflectionClass $instanceType, TEntityTypeType $entity, IMetadataProvider $meta)
18
    {
19
        $resourceTypeKind = ResourceTypeKind::ENTITY;
20
        $bitz = explode('.', $entity->getName());
21
        $name = array_pop($bitz);
22
        $namespaceName = null;
23
        if (0 < count($bitz)) {
24
            $namespaceName = implode('.', $bitz);
25
        }
26
        $rawType = $entity->getBaseType();
27
        $baseType = null == $rawType ? null : $meta->resolveResourceType($rawType);
28
        $isAbstract = $entity->getAbstract();
29
        parent::__construct($instanceType, $resourceTypeKind, $name, $namespaceName, $baseType, $isAbstract);
30
    }
31
}
32