Passed
Pull Request — master (#269)
by Christopher
03:11
created

ODataPropertyContent   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getPropertys() 0 3 1
A setPropertys() 0 8 2
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace POData\ObjectModel;
6
7
/**
8
 * Class ODataPropertyContent represents properties of a Complex type or entity element instance.
9
 */
10
class ODataPropertyContent
11
{
12
    /**
13
     * The collection of properties.
14
     *
15
     * @var ODataProperty[]
16
     */
17
    public $properties = [];
18
19
    /**
20
     * ODataPropertyContent constructor.
21
     * @param ODataProperty[] $properties
22
     */
23
    public function __construct(array $properties = [])
24
    {
25
        $this->setPropertys($properties);
26
    }
27
28
    /**
29
     * @return ODataProperty[]
30
     */
31
    public function getPropertys(): array
32
    {
33
        return $this->properties;
34
    }
35
36
    /**
37
     * @param $newProperties ODataProperty[]
38
     * @return ODataPropertyContent
39
     */
40
    public function setPropertys(array $newProperties): self
41
    {
42
43
        foreach ($newProperties as $key => $property) {
44
            $property->name = $key;
45
        }
46
        $this->properties = $newProperties;
47
        return $this;
48
    }
49
}
50