コード例 #1
0
ファイル: Validator.php プロジェクト: rybakdigital/ucc
 /**
  * Validates input field
  *
  * @param mixed $input      Data to validate
  * @param Check $check      Check to perform on input data
  * @return Validator
  */
 private function checkInput($input, $check)
 {
     $ret = false;
     // Check is specific type required
     if ($check->hasRequirement('type')) {
         $type = $check->getRequirement('type');
         if (in_array($type, array_keys(BasicTypes::$knownTypes))) {
             $method = BasicTypes::$knownTypes[$type];
             $callable = array('Ucc\\Data\\Types\\Basic\\BasicTypes', $method);
         } elseif (in_array($type, array_keys(PseudoTypes::$knownTypes))) {
             $method = PseudoTypes::$knownTypes[$type];
             $callable = array('Ucc\\Data\\Types\\Pseudo\\PseudoTypes', $method);
             // Check if custom class is called
         } elseif ($type == 'custom' && $check->hasRequirement('class') && $check->hasRequirement('method')) {
             $method = $check->getRequirement('method');
             $callable = array($check->getRequirement('method'), $method);
         }
     }
     $res = $this->checkValue($check->getKey(), $input, $check->getRequirements(), $callable);
     return $this;
 }
コード例 #2
0
ファイル: CheckTest.php プロジェクト: rybakdigital/ucc
 public function testGetKey()
 {
     $check = new Check();
     $this->assertNull($check->getKey());
 }