?
Array.php 0000666 00000000575 15125112562 0006346 0 ustar 00 <?php
require_once 'Zend/Validate/Abstract.php';
class Shanty_Mongo_Validate_Array extends Zend_Validate_Abstract
{
const NOT_ARRAY = 'notArray';
protected $_messageTemplates = array(
self::NOT_ARRAY => "Value is not an Array"
);
public function isValid($value)
{
if (!is_array($value)) {
$this->_error(self::NOT_ARRAY);
return false;
}
return true;
}
} Class.php 0000666 00000001523 15125112562 0006327 0 ustar 00 <?php
require_once 'Zend/Validate/Abstract.php';
class Shanty_Mongo_Validate_Class extends Zend_Validate_Abstract
{
const CLASS_NOT_VALID = 'classNotValid';
/**
* @var array
*/
protected $_messageTemplates = array(
self::CLASS_NOT_VALID => "'%value%' is not a %class%"
);
/**
* @var array
*/
protected $_messageVariables = array(
'class' => '_class'
);
protected $_class = null;
public function __construct($class)
{
$this->setClass($class);
}
public function setClass($class)
{
$this->_class = $class;
}
public function getClass()
{
return $this->_class;
}
public function isValid($value)
{
$this->_setValue($value);
$class = $this->getClass();
if (!($value instanceof $class)) {
$this->_error(self::CLASS_NOT_VALID);
return false;
}
return true;
}
} StubTrue.php 0000666 00000000204 15125112562 0007032 0 ustar 00 <?php
class Shanty_Mongo_Validate_StubTrue extends Zend_Validate_Abstract
{
public function isValid($value)
{
return true;
}
}