Completed
Push — master ( d37ad3...5c38af )
by Markus
15s queued 11s
created

ClassPropertyDefinition::getTypeNamespace()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Jellyfish\Transfer\Definition;
4
5
class ClassPropertyDefinition implements ClassPropertyDefinitionInterface
6
{
7
    /**
8
     * @var string
9
     */
10
    protected $name;
11
12
    /**
13
     * @var string
14
     */
15
    protected $type;
16
17
    /**
18
     * @var string|null
19
     */
20
    protected $typeAlias;
21
22
    /**
23
     * @var string|null
24
     */
25
    protected $typeNamespace;
26
27
    /**
28
     * @var string|null
29
     */
30
    protected $singular;
31
32
    /**
33
     * @var bool
34
     */
35
    protected $isNullable;
36
37
    /**
38
     * @var bool|null
39
     */
40
    protected $isArray;
41
42
    /**
43
     * @return string
44
     */
45
    public function getName(): string
46
    {
47
        return $this->name;
48
    }
49
50
    /**
51
     * @param string $name
52
     *
53
     * @return \Jellyfish\Transfer\Definition\ClassPropertyDefinitionInterface
54
     */
55
    public function setName(string $name): ClassPropertyDefinitionInterface
56
    {
57
        $this->name = $name;
58
59
        return $this;
60
    }
61
62
    /**
63
     * @return string
64
     */
65
    public function getType(): string
66
    {
67
        return $this->type;
68
    }
69
70
    /**
71
     * @param string $type
72
     *
73
     * @return \Jellyfish\Transfer\Definition\ClassPropertyDefinitionInterface
74
     */
75
    public function setType(string $type): ClassPropertyDefinitionInterface
76
    {
77
        $this->type = $type;
78
79
        return $this;
80
    }
81
82
    /**
83
     * @return string|null
84
     */
85
    public function getTypeAlias(): ?string
86
    {
87
        return $this->typeAlias;
88
    }
89
90
    /**
91
     * @param string|null $typeAlias
92
     *
93
     * @return \Jellyfish\Transfer\Definition\ClassPropertyDefinitionInterface
94
     */
95
    public function setTypeAlias(?string $typeAlias): ClassPropertyDefinitionInterface
96
    {
97
        $this->typeAlias = $typeAlias;
98
99
        return $this;
100
    }
101
102
    /**
103
     * @return string|null
104
     */
105
    public function getTypeNamespace(): ?string
106
    {
107
        return $this->typeNamespace;
108
    }
109
110
    /**
111
     * @param string|null $typeNamespace
112
     *
113
     * @return \Jellyfish\Transfer\Definition\ClassPropertyDefinitionInterface
114
     */
115
    public function setTypeNamespace(?string $typeNamespace): ClassPropertyDefinitionInterface
116
    {
117
        $this->typeNamespace = $typeNamespace;
118
119
        return $this;
120
    }
121
122
    /**
123
     * @return string|null
124
     */
125
    public function getSingular(): ?string
126
    {
127
        return $this->singular;
128
    }
129
130
    /**
131
     * @param string|null $singular
132
     *
133
     * @return \Jellyfish\Transfer\Definition\ClassPropertyDefinitionInterface
134
     */
135
    public function setSingular(?string $singular): ClassPropertyDefinitionInterface
136
    {
137
        $this->singular = $singular;
138
139
        return $this;
140
    }
141
142
    /**
143
     * @return bool
144
     */
145
    public function isNullable(): bool
146
    {
147
        return $this->isNullable;
148
    }
149
150
    /**
151
     * @param bool $isNullable
152
     *
153
     * @return \Jellyfish\Transfer\Definition\ClassPropertyDefinitionInterface
154
     */
155
    public function setIsNullable(bool $isNullable): ClassPropertyDefinitionInterface
156
    {
157
        $this->isNullable = $isNullable;
158
159
        return $this;
160
    }
161
162
    /**
163
     * @return bool
164
     */
165
    public function isPrimitive(): bool
166
    {
167
        return \preg_match('/^(int|float|string|bool(ean)?)$/', $this->type) === 1;
168
    }
169
170
    /**
171
     * @return bool
172
     */
173
    public function isArray(): bool
174
    {
175
        return $this->isArray === true;
176
    }
177
178
    /**
179
     * @param bool|null $isArray
180
     *
181
     * @return \Jellyfish\Transfer\Definition\ClassPropertyDefinitionInterface
182
     */
183
    public function setIsArray(?bool $isArray): ClassPropertyDefinitionInterface
184
    {
185
        $this->isArray = $isArray;
186
187
        return $this;
188
    }
189
}
190