예제 #1
0
 /**
  * Check rules for ComicVine API key.
  *
  * @param \ComicAPI\Tokens\TokenInterface $value Instance of Token.
  *
  * @return bool
  */
 protected function validComicVine(TokenInterface $value)
 {
     $valid = new Rules\AllOf(new Rules\Length(40), new Rules\StringType());
     if ($valid->validate($value->getToken()) === false) {
         return false;
     }
     return true;
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function validate($input)
 {
     if (!$this->hasValidStructure($input)) {
         return false;
     }
     return parent::validate($input);
 }
예제 #3
0
 /**
  * Validate filters or throws an exception.
  *
  * @param array                   $filters          List of filters
  * @param Rules\AllOf|Rules\OneOf $callable         Validation rules
  * @param string                  $exceptionMessage Exception message
  *
  * @throws \ComicAPI\Exceptions\ComicApiException
  */
 protected function validateFilters($filters, $callable, $exceptionMessage = "Invalid list of filters.")
 {
     if ($callable->validate($filters) === false) {
         throw new ComicApiException($exceptionMessage);
     }
 }