1 | <?php |
||
15 | abstract class Form extends Source { |
||
16 | /** |
||
17 | * @var int The ID for this form. |
||
18 | * |
||
19 | * @api |
||
20 | * @since future |
||
21 | */ |
||
22 | public $ID = null; |
||
23 | |||
24 | /** |
||
25 | * @var mixed The backing form. |
||
26 | */ |
||
27 | private $form; |
||
28 | |||
29 | /** |
||
30 | * Construct a \GV\Form instance by ID. |
||
31 | * |
||
32 | * @param int|string $form_id The internal form ID. |
||
33 | * |
||
34 | * @api |
||
35 | * @since future |
||
36 | * @return \GV\Form|null An instance of this form or null if not found. |
||
37 | */ |
||
38 | abstract public static function by_id( $form_id ); |
||
39 | |||
40 | /** |
||
41 | * Get all entries for this form. |
||
42 | * |
||
43 | * @api |
||
44 | * @since future |
||
45 | * |
||
46 | * @return \GV\Entry_Collection The \GV\Entry_Collection |
||
47 | */ |
||
48 | abstract public function get_entries(); |
||
49 | |||
50 | /** |
||
51 | * Magic shortcuts. |
||
52 | * |
||
53 | * - `entries` -> `$this->get_entries()` |
||
54 | */ |
||
55 | public function __get( $key ) { |
||
61 | } |
||
62 |
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.