コード例 #1
0
 /**
  * Ensures that getHaystack() returns expected value
  *
  * @return void
  */
 public function testGetHaystack()
 {
     $validator = new Zend_Validate_InArray(array(1, 2, 3));
     $this->assertEquals(array(1, 2, 3), $validator->getHaystack());
 }
コード例 #2
0
ファイル: Media.php プロジェクト: rukzuk/rukzuk
 /**
  * @param string   $direction
  * @return boolean
  */
 private function validateFilterDirection($direction)
 {
     $inArrayValidator = new InArrayValidator(array('ASC', 'DESC', 'asc', 'desc'));
     $allowedDirectionValues = implode(', ', $inArrayValidator->getHaystack());
     $message = "Filter direction '%value%' enthält keinen der folgenden " . "gültigen Werte ({$allowedDirectionValues})";
     $inArrayValidator->setMessage($message, InArrayValidator::NOT_IN_ARRAY);
     if (!$inArrayValidator->isValid($direction)) {
         $messages = array_values($inArrayValidator->getMessages());
         $this->addError(new Error('direction', $direction, $messages));
         return false;
     }
     return true;
 }