ACC SHELL
<?php
class TF_Validate_Psc extends Zend_Validate_Abstract
{
const NOT_PSC = 'notPsc';
/**
* @var array
*/
protected $_messageTemplates = array(
self::NOT_PSC => "'%value%' is not PSČ."
);
/**
* Defined by Zend_Validate_Interface
*
* Returns true if and only if $value is a valid integer
*
* @param string $value
* @return boolean
*/
public function isValid($value)
{
$phoneNumber = (string)$value;
$pattern = '^[0-9]{3}[ ]?[0-9]{2}$';
if(eregi($pattern, $value)){
return true;
} else {
$this->_error(self::NOT_PSC, $value);
return false;
}
}
}
ACC SHELL 2018