diff --git a/lib/Doctrine/Validator/Driver.php b/lib/Doctrine/Validator/Driver.php new file mode 100644 index 000000000..7199be853 --- /dev/null +++ b/lib/Doctrine/Validator/Driver.php @@ -0,0 +1,118 @@ +. + */ + +/** + * Doctrine_Validator_Driver + * + * @package Doctrine + * @category Object Relational Mapping + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @link www.phpdoctrine.com + * @since 1.0 + * @version $Revision: 1080 $ + * @author Konsta Vesterinen + */ +class Doctrine_Validator_Driver +{ + /** + * @var array $_args an array of plugin specific args + */ + protected $_args = array(); + /** + * __get + * an alias for getOption + * + * @param string $arg + */ + public function __get($arg) + { + if (isset($this->_args[$arg])) { + return $this->_args[$arg]; + } + return null; + } + /** + * __isset + * + * @param string $arg + */ + public function __isset($arg) + { + return isset($this->_args[$arg]); + } + /** + * sets given value to an argument + * + * @param $arg the name of the option to be changed + * @param $value the value of the option + * @return Doctrine_Validator_Driver this object + */ + public function __set($arg, $value) + { + if ( ! isset($this->_args[$arg])) { + throw new Doctrine_Plugin_Exception('Unknown argument ' . $arg); + } + + $this->_args[$arg] = $value; + + return $this; + } + /** + * returns the value of an argument + * + * @param $arg the name of the option to retrieve + * @return mixed the value of the option + */ + public function getArg($arg) + { + if ( ! isset($this->_args[$arg])) { + throw new Doctrine_Plugin_Exception('Unknown option ' . $arg); + } + + return $this->_args[$arg]; + } + /** + * sets given value to an argument + * + * @param $arg the name of the option to be changed + * @param $value the value of the option + * @return Doctrine_Validator_Driver this object + */ + public function setArg($arg, $value) + { + if ( ! isset($this->_args[$arg])) { + throw new Doctrine_Plugin_Exception('Unknown argument ' . $arg); + } + + $this->_args[$arg] = $value; + + return $this; + } + /** + * returns all args and their associated values + * + * @return array all args as an associative array + */ + public function getArgs() + { + return $this->_args; + } +} diff --git a/lib/Doctrine/Validator/Interface.class.php b/lib/Doctrine/Validator/Interface.class.php deleted file mode 100644 index ec5521561..000000000 --- a/lib/Doctrine/Validator/Interface.class.php +++ /dev/null @@ -1,4 +0,0 @@ -