1 | <?php |
||
12 | abstract class AbstractEntity implements EntityInterface |
||
13 | { |
||
14 | /** |
||
15 | * The data for this AbstractEntity |
||
16 | * |
||
17 | * @var array |
||
18 | */ |
||
19 | private $data = []; |
||
20 | |||
21 | /** |
||
22 | * Create a new AbstractEntity based on the given $input array. |
||
23 | * |
||
24 | * @param array $input The data for the EntityInterface. |
||
25 | */ |
||
26 | final public function __construct(array $input = []) |
||
35 | |||
36 | /** |
||
37 | * Get an AbstractEntity property. |
||
38 | * |
||
39 | * @param string $name The name of the property. |
||
40 | * |
||
41 | * @return mixed |
||
42 | * |
||
43 | * @throws UndefinedPropertyException Thrown if $name is not a valid class property. |
||
44 | */ |
||
45 | final public function __get($name) |
||
54 | |||
55 | /** |
||
56 | * Allows for getX() method calls. |
||
57 | * |
||
58 | * @param string $name The name of the method being called. |
||
59 | * @param array $arguments The arguments being passed to the method. This parameter is unused. |
||
60 | * |
||
61 | * @return mixed |
||
62 | * |
||
63 | * @throws \BadMethodCallException Thrown if the property being accessed does not exist. |
||
64 | */ |
||
65 | final public function __call($name, array $arguments = []) |
||
81 | |||
82 | /** |
||
83 | * Create an array of new AbstractEntity based on the given $input arrays. |
||
84 | * |
||
85 | * @param array[] $inputs The value to be filtered. |
||
86 | * |
||
87 | * @return EntityCollection |
||
88 | */ |
||
89 | final public static function fromArrays(array $inputs) |
||
100 | |||
101 | /** |
||
102 | * Create a new AbstractEntity based on the given $input array. |
||
103 | * |
||
104 | * @param array $input The data for the AbstractEntity. |
||
105 | * |
||
106 | * @return AbstractEntity |
||
107 | */ |
||
108 | final public static function fromArray(array $input) |
||
112 | |||
113 | /** |
||
114 | * Returns the data for this object which can be serialized to JSON. |
||
115 | * |
||
116 | * @return array |
||
117 | */ |
||
118 | public function jsonSerialize() |
||
122 | |||
123 | /** |
||
124 | * Returns an array of filters suitable for use with \DominionEnterprises\Filterer::filter(). |
||
125 | * |
||
126 | * @return array |
||
127 | */ |
||
128 | abstract protected function getFilters(); |
||
129 | } |
||
130 |