public function index01Action() { echo "<h3 style='color:red;font-weight:bold'>" . __METHOD__ . "</h3>"; //case 1 // $validator = new \Zend\Validator\Between(2,5,false); //case 2 // $validator = new \Zend\Validator\Between(array("min"=>"2","max"=>5,"inclusive"=>false)); //case 3 $validator = new \Zend\Validator\Between(5, 6); $validator->setMin(1)->setMax(3)->setInclusive(true); $input = "3a"; $input = "a3a"; $input = 4; if (!$validator->isValid($input)) { $message = $validator->getMessages(); echo "<pre style='font-weight:bold'>"; print_r($message); echo "</pre>"; echo current($message); } else { echo "ok"; } return false; }
/** * set the max result hits for this search * * @param integer $hits * @return Zend_Service_DeveloperGarden_LocalSearch_SearchParameters */ public function setHits($hits = 10) { $validator = new Zend\Validator\Between(0, 1000); if (!$validator->isValid($hits)) { $message = $validator->getMessages(); throw new Zend_Service_DeveloperGarden_LocalSearch_Exception(current($message)); } $this->_parameters['hits'] = $hits; return $this; }