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

ODataProperty   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 48
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isNull() 0 3 2
A __construct() 0 6 1
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