ClassPropertyProcessor   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 7
c 2
b 0
f 0
dl 0
loc 30
ccs 10
cts 10
cp 1
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A processProperty() 0 7 2
A process() 0 4 2
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;
15
16
use Micro\Library\DTO\ClassDef\ClassDefinition;
17
use Micro\Library\DTO\ClassDef\PropertyDefinition;
18
use Micro\Library\DTO\Preparation\PreparationProcessorInterface;
19
use Micro\Library\DTO\Preparation\Processor\Property\PropertyProcessorInterface;
20
21
class ClassPropertyProcessor implements PreparationProcessorInterface
22
{
23
    /**
24
     * @param iterable<PropertyProcessorInterface> $propertyProcessorCollection
25
     */
26 6
    public function __construct(private iterable $propertyProcessorCollection)
27
    {
28 6
    }
29
30 3
    public function process(array $classDef, ClassDefinition $classDefinition, array $classList): void
31
    {
32 3
        foreach ($classDef[self::SECTION_PROPERTIES] as $property) {
33 3
            $this->processProperty($classDefinition, $property, $classList);
34
        }
35
    }
36
37
    /**
38
     * @param ClassDefinition      $classDefinition
39
     * @param array<string, mixed> $propertyData
40
     * @param array<string>        $classList
41
     *
42
     * @return void
43
     */
44 3
    protected function processProperty(ClassDefinition $classDefinition, array $propertyData, array $classList): void
45
    {
46 3
        $property = new PropertyDefinition();
47 3
        $classDefinition->addProperty($property);
48
49 3
        foreach ($this->propertyProcessorCollection as $processor) {
50 3
            $processor->process($property, $classDefinition, $propertyData, $classList);
51
        }
52
    }
53
}
54