예제 #1
0
 /**
  * Check Options Integrity
  *
  * @throws Next\HTTP\Headers\Fields\FieldsException
  *   Header Field has no well-formed name
  *
  * @throws Next\HTTP\Headers\Fields\FieldsException
  *   Object defined as validator is not instance of Nex\Validate\Validate
  *
  * @throws Next\HTTP\Headers\Fields\FieldsException
  *   Provided validator is not a Header Field Validator, characterized
  *   as instance of Nex\Validate\HTTP\Headers\Headers
  */
 private function checkIntegrity()
 {
     // Headers Options
     if (!isset($this->options->name) || empty($this->options->name)) {
         throw FieldsException::unfullfilledRequirements('Headers must have a name!');
     }
     // Validator Interfaces Implementations
     $validator = $this->getValidator();
     if (!$validator instanceof Validate) {
         throw FieldsException::unfullfilledRequirements('Header Fields Validators must implement Validate Interface');
     }
     if (!$validator instanceof Headers) {
         throw FieldsException::unfullfilledRequirements('HTTP Headers Validators must implement HTTP Headers Validate Interface');
     }
 }