1 | <?php |
||
19 | class PropertyDefinition { |
||
20 | |||
21 | /** |
||
22 | * The property name. |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $name; |
||
27 | |||
28 | /** |
||
29 | * The entity type if this property is an entity. |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $entityType; |
||
34 | |||
35 | /** |
||
36 | * Whether this property is an array or not. |
||
37 | * |
||
38 | * @var bool |
||
39 | */ |
||
40 | protected $isArray; |
||
41 | |||
42 | /** |
||
43 | * Creates a new property definition. |
||
44 | * |
||
45 | * @param string $name |
||
46 | * The name of the property. |
||
47 | * @param string|null $entityType |
||
48 | * The entity type of the property if it's an entity. |
||
49 | * @param bool $isArray |
||
50 | * Whether or not this property is an array. |
||
51 | */ |
||
52 | 3 | public function __construct($name, $entityType = NULL, $isArray = FALSE) { |
|
53 | 3 | $this->name = $name; |
|
54 | 3 | $this->entityType = $entityType; |
|
55 | 3 | $this->isArray = $isArray; |
|
56 | 3 | } |
|
57 | |||
58 | /** |
||
59 | * Gets the property name. |
||
60 | * |
||
61 | * @return string |
||
62 | * The property name. |
||
63 | */ |
||
64 | 1 | public function getName() { |
|
65 | 1 | return $this->name; |
|
66 | } |
||
67 | |||
68 | /** |
||
69 | * Gets the entity type. |
||
70 | * |
||
71 | * @return string|null |
||
72 | * The entity type of the property if it's an entity. |
||
73 | */ |
||
74 | 1 | public function getEntityType() { |
|
75 | 1 | return $this->entityType; |
|
76 | } |
||
77 | |||
78 | /** |
||
79 | * Whether or not this property is an array. |
||
80 | * |
||
81 | * @return bool |
||
82 | * TRUE if it's an array, FALSE, otherwise. |
||
83 | */ |
||
84 | 1 | public function isArray() { |
|
85 | 1 | return $this->isArray; |
|
86 | } |
||
87 | |||
88 | /** |
||
89 | * Sanitizes an object property based on this definition. |
||
90 | * |
||
91 | * @param \stdClass $object |
||
92 | * The object of which to sanitize the property. |
||
93 | * @param \TheSportsDb\Entity\Factory\FactoryContainerInterface $factoryContainer |
||
94 | * The factory container. |
||
95 | * |
||
96 | * @return void |
||
97 | */ |
||
98 | 1 | public function sanitizeProperty(\stdClass &$object, FactoryContainerInterface $factoryContainer) { |
|
114 | } |
||
115 |