| 1 | <?php |
||
| 4 | final class UnavailableAfter implements directiveInterface |
||
| 5 | { |
||
| 6 | const DIRECTIVE = 'unavailable_after'; |
||
| 7 | |||
| 8 | const DATE_GOOGLE = 'd M Y H:i:s T'; |
||
| 9 | |||
| 10 | private $supportedDateFormats = [ |
||
| 11 | DATE_RFC850, |
||
| 12 | self::DATE_GOOGLE |
||
| 13 | ]; |
||
| 14 | |||
| 15 | private $value; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Constructor |
||
| 19 | * |
||
| 20 | * @param string $rule |
||
| 21 | * @param array $options |
||
| 22 | */ |
||
| 23 | public function __construct($rule, $options = []) |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Get directive name |
||
| 35 | * |
||
| 36 | * @return string |
||
| 37 | */ |
||
| 38 | public function getDirective() |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Get value |
||
| 45 | * |
||
| 46 | * @return string|null |
||
| 47 | */ |
||
| 48 | public function getValue() |
||
| 61 | } |
||
| 62 | |||
| 63 |
If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration: