Пример #1
0
 /**
  * Filter the redirect url
  *
  * @param mixed $value
  * @return string|null
  */
 public function filter($value)
 {
     if (!$this->validator->isValid($value)) {
         return null;
     }
     return urldecode(filter_var($value, FILTER_SANITIZE_URL));
 }
Пример #2
0
 /**
  * checks to see if the value passed is
  * valid input for the ColumnDefinition
  * injected
  *
  * @param mixed $value
  *
  * @return boolean
  */
 public function isValid($value)
 {
     if ($this->validator) {
         return $this->validator->isValid($value);
     } else {
         return false;
     }
 }
Пример #3
0
 /**
  * Do the validation
  *
  * @param  mixed $value
  * @return boolean
  */
 protected function validate($value)
 {
     return Match::on(Option::create($this->validator->isValid($value), false))->Monad_Option_Some(true)->Monad_Option_None(function () {
         $msgs = $this->validator->getMessages();
         array_walk($msgs, function ($msg) {
             $this->messenger->add(new StringType($msg));
         });
         return false;
     })->value();
 }
Пример #4
0
 /**
  * Returns TRUE to accept the message, FALSE to block it.
  *
  * @param array $event event data
  * @return bool
  */
 public function filter(array $event)
 {
     return $this->validator->isValid($event['message']);
 }
Пример #5
0
 /**
  * @param mixed               $value
  * @param CollectionInterface $collection
  *
  * @return bool
  */
 public function __invoke($value, CollectionInterface $collection = null)
 {
     return $this->validator->isValid($value, $collection);
 }