Example #1
0
 /**
  * Set arguments for checking
  *
  * @param array $arguments
  *
  * @return AbstractRule
  * @throws \Magelight\Exception
  */
 public function setArguments($arguments = [])
 {
     $dateRule = DateTime::forge();
     if (!isset($arguments[0]) || !isset($arguments[1])) {
         throw new \Magelight\Exception('Arguments for DatRange rule must be passed.');
     }
     if (!$dateRule->check($arguments[0]) || !$dateRule->check($arguments[1])) {
         throw new \Magelight\Exception('Arguments for DatRange rule must be valid date strings.');
     }
     return parent::setArguments($arguments);
 }