Completed
Push — master ( 480c88...01d8db )
by Valentin
08:43
created

Structure   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 39
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 1
A methodNames() 0 9 2
A __construct() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Cycle\ORM\Promise\Declaration;
5
6
class Structure
7
{
8
    /** @var string[] */
9
    public $properties = [];
10
11
    /** @var string[] */
12
    public $constants = [];
13
14
    /** @var \PhpParser\Node\Stmt\ClassMethod[] */
15
    public $methods = [];
16
17
    /** @var bool */
18
    public $hasClone;
19
20
    public static function create(array $constants, array $properties, array $methods, bool $hasClone): Structure
21
    {
22
        $self = new self();
23
        $self->constants = $constants;
24
        $self->properties = $properties;
25
        $self->methods = $methods;
26
        $self->hasClone = $hasClone;
27
28
        return $self;
29
    }
30
31
    public function methodNames(): array
32
    {
33
        $names = [];
34
        foreach ($this->methods as $method) {
35
            $names[] = $method->name->name;
36
        }
37
38
        return $names;
39
    }
40
41
    protected function __construct()
42
    {
43
    }
44
}