| 1 | <?php |
||
| 10 | class MessageCollection extends Collectable { |
||
| 11 | |||
| 12 | /** |
||
| 13 | * __construct |
||
| 14 | * |
||
| 15 | * @since 0.11.0 |
||
| 16 | * |
||
| 17 | * @param array $form Config array |
||
| 18 | */ |
||
| 19 | public function __construct( array $form ) { |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Return the message array |
||
| 25 | * |
||
| 26 | * @since 0.11.0 |
||
| 27 | * |
||
| 28 | * @return array |
||
| 29 | */ |
||
| 30 | public function get_array() { |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Return a custom error message for a field's rule |
||
| 36 | * |
||
| 37 | * @since 0.11.0 |
||
| 38 | * |
||
| 39 | * @param string $field |
||
| 40 | * @param string $rule |
||
| 41 | * @return array|null |
||
| 42 | */ |
||
| 43 | public function get_msg( $field, $rule ) { |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Filter out fields that do not have custom error messages |
||
| 51 | * from the config array |
||
| 52 | * |
||
| 53 | * @since 0.11.0 |
||
| 54 | * @access protected |
||
| 55 | * |
||
| 56 | * @param array $form |
||
| 57 | * @return array |
||
| 58 | */ |
||
| 59 | protected function filter_config( array $form ) { |
||
| 64 | |||
| 65 | /** |
||
| 66 | * |
||
| 67 | * |
||
| 68 | * @since 0.11.0 |
||
| 69 | * @access protected |
||
| 70 | * |
||
| 71 | * @param array |
||
| 72 | */ |
||
| 73 | protected function make_array( array $filtered ) { |
||
| 80 | |||
| 81 | /** |
||
| 82 | * |
||
| 83 | * |
||
| 84 | * @since 0.11.0 |
||
| 85 | * @access protected |
||
| 86 | * |
||
| 87 | * @param array $form |
||
| 88 | */ |
||
| 89 | protected function set_messages( array $form ) { |
||
| 93 | } |
||
| 94 |
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.