1 | <?php |
||
16 | class ScalarBeanPropertyDescriptor extends AbstractBeanPropertyDescriptor |
||
17 | { |
||
18 | /** |
||
19 | * @var Column |
||
20 | */ |
||
21 | private $column; |
||
22 | |||
23 | /** |
||
24 | * ScalarBeanPropertyDescriptor constructor. |
||
25 | * @param Table $table |
||
26 | * @param Column $column |
||
27 | * @param NamingStrategyInterface $namingStrategy |
||
28 | */ |
||
29 | public function __construct(Table $table, Column $column, NamingStrategyInterface $namingStrategy) |
||
35 | |||
36 | /** |
||
37 | * Returns the foreign-key the column is part of, if any. null otherwise. |
||
38 | * |
||
39 | * @return ForeignKeyConstraint|null |
||
40 | */ |
||
41 | public function getForeignKey() |
||
45 | |||
46 | /** |
||
47 | * Returns the param annotation for this property (useful for constructor). |
||
48 | * |
||
49 | * @return string |
||
50 | */ |
||
51 | public function getParamAnnotation() |
||
59 | |||
60 | /** |
||
61 | * Returns the name of the class linked to this property or null if this is not a foreign key. |
||
62 | * |
||
63 | * @return null|string |
||
64 | */ |
||
65 | public function getClassName(): ?string |
||
69 | |||
70 | /** |
||
71 | * Returns the PHP type for the property (it can be a scalar like int, bool, or class names, like \DateTimeInterface, App\Bean\User....) |
||
72 | * |
||
73 | * @return string |
||
74 | */ |
||
75 | public function getPhpType(): string |
||
80 | |||
81 | /** |
||
82 | * Returns true if the property is compulsory (and therefore should be fetched in the constructor). |
||
83 | * |
||
84 | * @return bool |
||
85 | */ |
||
86 | public function isCompulsory() |
||
90 | |||
91 | private function hasUuidAnnotation(): bool |
||
95 | |||
96 | private function getUuidAnnotation(): ?Annotation |
||
106 | |||
107 | /** |
||
108 | * Returns true if the property has a default value (or if the @UUID annotation is set for the column) |
||
109 | * |
||
110 | * @return bool |
||
111 | */ |
||
112 | public function hasDefault() |
||
116 | |||
117 | /** |
||
118 | * Returns the code that assigns a value to its default value. |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | public function assignToDefaultCode() |
||
152 | |||
153 | /** |
||
154 | * Returns true if the property is the primary key. |
||
155 | * |
||
156 | * @return bool |
||
157 | */ |
||
158 | public function isPrimaryKey() |
||
162 | |||
163 | /** |
||
164 | * Returns the PHP code for getters and setters. |
||
165 | * |
||
166 | * @return string |
||
167 | */ |
||
168 | public function getGetterSetterCode() |
||
223 | |||
224 | /** |
||
225 | * Returns the part of code useful when doing json serialization. |
||
226 | * |
||
227 | * @return string |
||
228 | */ |
||
229 | public function getJsonSerializeCode() |
||
239 | |||
240 | /** |
||
241 | * Returns the column name. |
||
242 | * |
||
243 | * @return string |
||
244 | */ |
||
245 | public function getColumnName() |
||
249 | } |
||
250 |
As per the PSR-2 coding standard, case statements should not be wrapped in curly braces. There is no need for braces, since each case is terminated by the next
break
.There is also the option to use a semicolon instead of a colon, this is discouraged because many programmers do not even know it works and the colon is universal between programming languages.
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.