1 | <?php |
||
26 | class Potato implements PotatoInterface |
||
27 | { |
||
28 | /** |
||
29 | * @var array Array for holding properties set with magic method __set() |
||
30 | */ |
||
31 | protected $record = []; |
||
32 | |||
33 | /** |
||
34 | * Set property dynamically |
||
35 | * |
||
36 | * @param string $field Property set dynamically |
||
37 | * @param string $value Value of property set dynamically |
||
38 | */ |
||
39 | public function __set($field, $value) |
||
43 | |||
44 | /** |
||
45 | * @param string connection to class name |
||
46 | * @return string table name of Called class |
||
47 | */ |
||
48 | public function tableName() |
||
52 | |||
53 | /** |
||
54 | * Provide a read access to protected $record array |
||
55 | * |
||
56 | * @return array $record Array of variables set dynamically with method __set() |
||
57 | */ |
||
58 | public function getRecord() |
||
62 | |||
63 | /** |
||
64 | * @return object Database connection |
||
65 | */ |
||
66 | protected function makeDbConn() |
||
71 | |||
72 | /** |
||
73 | * Get a distinct record from the database |
||
74 | * |
||
75 | * @param int $record Index of record to get |
||
76 | * @return string|object |
||
77 | */ |
||
78 | public function find($record) |
||
82 | |||
83 | /** |
||
84 | * Get a record in the database |
||
85 | * |
||
86 | * @param string $field Field name to search under |
||
87 | * @param string $value Field value to search for |
||
88 | * @return string|object |
||
89 | */ |
||
90 | public function where($field, $value) |
||
112 | |||
113 | /** |
||
114 | * Get all the records in a database table |
||
115 | * @return array|object |
||
116 | * @return exception |
||
117 | */ |
||
118 | public function getAll() |
||
137 | |||
138 | /** |
||
139 | * Insert or Update a record in a database table |
||
140 | * @return inte |
||
141 | * @return exception |
||
142 | */ |
||
143 | public function save() |
||
168 | |||
169 | /** |
||
170 | * Delete a record from the database table |
||
171 | * @param int $record Index of record to be deleted |
||
172 | * @return bool|string |
||
173 | * @return exception |
||
174 | */ |
||
175 | public function destroy($record) |
||
194 | } |
||
195 |
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.