| 1 | <?php |
||
| 13 | class ValidatorFactory extends AbstractFactory { |
||
| 14 | |||
| 15 | /** |
||
| 16 | * |
||
| 17 | * |
||
| 18 | * @since 0.11.0 |
||
| 19 | * @access protected |
||
| 20 | * @var array |
||
| 21 | */ |
||
| 22 | protected $messages = array(); |
||
| 23 | |||
| 24 | /** |
||
| 25 | * __construct |
||
| 26 | * |
||
| 27 | * @since 0.11.0 |
||
| 28 | * |
||
| 29 | * @param array $messages Custom error messages |
||
| 30 | */ |
||
| 31 | function __construct( array $messages ) { |
||
| 34 | |||
| 35 | /** |
||
| 36 | * |
||
| 37 | * |
||
| 38 | * @since 0.11.0 |
||
| 39 | * |
||
| 40 | * @param string $rule |
||
| 41 | * @param string $field |
||
| 42 | * @param array $params |
||
| 43 | * @param bool (optional) $optional |
||
| 44 | * @return ValidateInterface |
||
| 45 | */ |
||
| 46 | public function create( $rule, $field, $params, $optional = false ) { |
||
| 54 | |||
| 55 | /** |
||
| 56 | * |
||
| 57 | * |
||
| 58 | * @since 0.11.0 |
||
| 59 | * @access protected |
||
| 60 | * |
||
| 61 | * @param string $rule |
||
| 62 | * @return string |
||
| 63 | */ |
||
| 64 | protected function class_name( $rule ){ |
||
| 68 | } |
||
| 69 |
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.