1 | <?php |
||
6 | class ImageRatio extends AbstractRule |
||
7 | { |
||
8 | // the image width/height ration; |
||
9 | // can be a number or a string like 4:3, 16:9 |
||
10 | const OPTION_RATIO = 'ratio'; |
||
11 | // how much can the image ratio diverge from the allowed ratio |
||
12 | const OPTION_ERROR_MARGIN = 'error_margin'; |
||
13 | |||
14 | const MESSAGE = 'The image does must have a ratio (width/height) of {ratio})'; |
||
15 | |||
16 | const LABELED_MESSAGE = '{label} does must have a ratio (width/height) of {ratio})'; |
||
17 | |||
18 | protected $options = array( |
||
19 | self::OPTION_RATIO => 0, |
||
20 | self::OPTION_ERROR_MARGIN => 0, |
||
21 | ); |
||
22 | |||
23 | 6 | protected function normalizeRatio($ratio) |
|
36 | |||
37 | 6 | public function validate($value, $valueIdentifier = null) |
|
59 | } |
||
60 |