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

ODataBagContent::setPropertyContents()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace POData\ObjectModel;
6
7
/**
8
 * Class ODataBagContent
9
 *  Represents value of a bag (collection) property. Bag can be of two types:
10
 *  (1) Primitive Bag
11
 *  (2) Complex Bag.
12
 */
13
class ODataBagContent
14
{
15
    /**
16
     * The type name of the element.
17
     *
18
     * @var string|null
19
     */
20
    private $type;
21
    /**
22
     * Represents elements of the bag.
23
     *
24
     * @var string[]|ODataPropertyContent[]|null
25
     */
26
    private $propertyContents;
27
28
    /**
29
     * ODataBagContent constructor.
30
     * @param string $type
31
     * @param ODataPropertyContent[]|string[] $propertyContents
32
     */
33
    public function __construct(string $type = null, array $propertyContents = null)
34
    {
35
        $this->type = $type;
36
        $this->propertyContents = $propertyContents;
37
    }
38
39
    /**
40
     * @return string|null
41
     */
42
    public function getType(): ?string
43
    {
44
        return $this->type;
45
    }
46
47
    /**
48
     * @param string|null $type
49
     * @return ODataBagContent
50
     */
51
    public function setType(?string $type): ODataBagContent
52
    {
53
        $this->type = $type;
54
        return $this;
55
    }
56
57
    /**
58
     * @return ODataPropertyContent[]|string[]
59
     */
60
    public function getPropertyContents()
61
    {
62
        return $this->propertyContents;
63
    }
64
65
    /**
66
     * @param ODataPropertyContent[]|string[] $propertyContents
67
     * @return ODataBagContent
68
     */
69
    public function setPropertyContents($propertyContents)
70
    {
71
        $this->propertyContents = $propertyContents;
72
        return $this;
73
    }
74
75
    public function addPropertyContent($propertyContent){
76
        $this->propertyContents[] = $propertyContent;
77
        return $this;
78
79
    }
80
81
}
82