PropertyAbstractProcessor   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 16
ccs 8
cts 8
cp 1
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 14 3
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 *  This file is part of the Micro framework package.
7
 *
8
 *  (c) Stanislau Komar <[email protected]>
9
 *
10
 *  For the full copyright and license information, please view the LICENSE
11
 *  file that was distributed with this source code.
12
 */
13
14
namespace Micro\Library\DTO\Preparation\Processor\Property;
15
16
use Micro\Library\DTO\ClassDef\ClassDefinition;
17
use Micro\Library\DTO\ClassDef\PropertyDefinition;
18
use Micro\Library\DTO\Helper\ClassMetadataHelperInterface;
19
20
class PropertyAbstractProcessor implements PropertyProcessorInterface
21
{
22 1
    public function process(PropertyDefinition $propertyDefinition, ClassDefinition $classDefinition, array $propertyData, array $classList): void
23
    {
24 1
        $types = $propertyDefinition->getTypes();
25
26 1
        foreach ($types as $pos => $type) {
27 1
            if (mb_strtolower($type) !== mb_strtolower(ClassMetadataHelperInterface::PROPERTY_TYPE_ABSTRACT)) {
28 1
                continue;
29
            }
30
31 1
            $types[$pos] = ClassMetadataHelperInterface::PROPERTY_TYPE_ABSTRACT_CLASS;
32 1
            $classDefinition->addUseStatement(ClassMetadataHelperInterface::PROPERTY_TYPE_ABSTRACT_CLASS);
33
        }
34
35 1
        $propertyDefinition->setTypes(array_unique($types));
36
    }
37
}
38