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

ODataProperty::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 4
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace POData\ObjectModel;
6
7
/**
8
 * Class ODataProperty
9
 * Represents a property that comes under "m:properties" node or entry
10
 * or under complex property.
11
 */
12
class ODataProperty
13
{
14
    /**
15
     * The name of the property.
16
     *
17
     * @var string
18
     */
19
    public $name;
20
    /**
21
     * The property type name.
22
     *
23
     * @var string
24
     */
25
    public $typeName;
26
    /**
27
     * The property attribute extensions.
28
     *
29
     * @var XMLAttribute[]
30
     */
31
    public $attributeExtensions;
32
    /**
33
     * The value of the property.
34
     *
35
     * @var string|ODataPropertyContent|ODataBagContent
36
     */
37
    public $value;
38
39
    /**
40
     * ODataProperty constructor.
41
     * @param string $name
42
     * @param string $typeName
43
     * @param XMLAttribute[] $attributeExtensions
44
     * @param ODataBagContent|ODataPropertyContent|string $value
45
     */
46
    public function __construct(string $name = null, ?string $typeName = null, $value = null, array $attributeExtensions = null)
47
    {
48
        $this->name = $name;
49
        $this->typeName = $typeName;
50
        $this->attributeExtensions = $attributeExtensions;
51
        $this->value = $value;
52
    }
53
54
    /**
55
     * @return bool|null
56
     */
57
    public function isNull(): ?bool
58
    {
59
        return null === $this->value ? true : null;
60
    }
61
}
62