1 | <?php |
||
14 | class GF_Form extends Form implements \ArrayAccess { |
||
15 | |||
16 | /** |
||
17 | * @var string The identifier of the backend used for this form. |
||
18 | * @api |
||
19 | * @since 2.0 |
||
20 | */ |
||
21 | public static $backend = self::BACKEND_GRAVITYFORMS; |
||
22 | |||
23 | /** |
||
24 | * Initialization. |
||
25 | */ |
||
26 | 71 | private function __construct() { |
|
31 | |||
32 | /** |
||
33 | * Construct a \GV\GF_Form instance by ID. |
||
34 | * |
||
35 | * @param int|string $form_id The internal form ID. |
||
36 | * |
||
37 | * @api |
||
38 | * @since 2.0 |
||
39 | * @return \GV\GF_Form|null An instance of this form or null if not found. |
||
40 | */ |
||
41 | 72 | public static function by_id( $form_id ) { |
|
62 | |||
63 | /** |
||
64 | * Construct a \GV\Form instance from a Gravity Forms form array. |
||
65 | * |
||
66 | * @since 2.0.7 |
||
67 | * |
||
68 | * @param array $form The form array |
||
69 | * |
||
70 | * @return \GV\GF_Form|null An instance of this form or null if not found. |
||
71 | */ |
||
72 | public static function from_form( $form ) { |
||
83 | |||
84 | /** |
||
85 | * Get all entries for this form. |
||
86 | * |
||
87 | * @api |
||
88 | * @since 2.0 |
||
89 | * |
||
90 | * @return \GV\Entry_Collection The \GV\Entry_Collection |
||
91 | */ |
||
92 | 1 | public function get_entries() { |
|
152 | |||
153 | /** |
||
154 | * Get a \GV\Field by Form and Field ID for this data source. |
||
155 | * |
||
156 | * @param \GV\GF_Form $form The Gravity Form form ID. |
||
157 | * @param int $field_id The Gravity Form field ID for the $form_id. |
||
158 | * |
||
159 | * @return \GV\Field|null The requested field or null if not found. |
||
160 | */ |
||
161 | 3 | public static function get_field( /** varargs */ ) { |
|
175 | |||
176 | /** |
||
177 | * Get an array of GV Fields for this data source |
||
178 | * |
||
179 | * @return \GV\Field[]|array Empty array if no fields |
||
180 | */ |
||
181 | public function get_fields() { |
||
195 | |||
196 | /** |
||
197 | * Proxies. |
||
198 | * |
||
199 | * @param string $key The property to get. |
||
200 | * |
||
201 | * @return mixed |
||
202 | */ |
||
203 | 1 | public function __get( $key ) { |
|
211 | |||
212 | /** |
||
213 | * ArrayAccess compatibility layer with a Gravity Forms form array. |
||
214 | * |
||
215 | * @internal |
||
216 | * @deprecated |
||
217 | * @since 2.0 |
||
218 | * @return bool Whether the offset exists or not. |
||
219 | */ |
||
220 | 15 | public function offsetExists( $offset ) { |
|
223 | |||
224 | /** |
||
225 | * ArrayAccess compatibility layer with a Gravity Forms form array. |
||
226 | * |
||
227 | * Maps the old keys to the new data; |
||
228 | * |
||
229 | * @internal |
||
230 | * @deprecated |
||
231 | * @since 2.0 |
||
232 | * |
||
233 | * @return mixed The value of the requested form data. |
||
234 | */ |
||
235 | 11 | public function offsetGet( $offset ) { |
|
238 | |||
239 | /** |
||
240 | * ArrayAccess compatibility layer with a Gravity Forms form array. |
||
241 | * |
||
242 | * @internal |
||
243 | * @deprecated |
||
244 | * @since 2.0 |
||
245 | * |
||
246 | * @return void |
||
247 | */ |
||
248 | public function offsetSet( $offset, $value ) { |
||
251 | |||
252 | /** |
||
253 | * ArrayAccess compatibility layer with a Gravity Forms form array. |
||
254 | * |
||
255 | * @internal |
||
256 | * @deprecated |
||
257 | * @since 2.0 |
||
258 | * @return void |
||
259 | */ |
||
260 | public function offsetUnset( $offset ) { |
||
263 | } |
||
264 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.