/** * 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; }
/** * {@inheritdoc} */ public function validate($input) { if (!$this->hasValidStructure($input)) { return false; } return parent::validate($input); }
/** * 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); } }