1 |
<?php
|
2 |
/*
|
3 |
* $Id: Notnull.php 1080 2007-02-10 18:17:08Z romanb $
|
4 |
*
|
5 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
6 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
7 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
8 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
9 |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
10 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
11 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
12 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
13 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
14 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
15 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
16 |
*
|
17 |
* This software consists of voluntary contributions made by many individuals
|
18 |
* and is licensed under the LGPL. For more information, see
|
19 |
* <http://www.phpdoctrine.com>.
|
20 |
*/
|
21 |
|
22 |
/**
|
23 |
* Doctrine_Validator_Driver
|
24 |
*
|
25 |
* @package Doctrine
|
26 |
* @subpackage Validator
|
27 |
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
28 |
* @link www.phpdoctrine.com
|
29 |
* @since 1.0
|
30 |
* @version $Revision: 1080 $
|
31 |
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
32 |
*/
|
33 |
class Doctrine_Validator_Driver
|
34 |
{
|
35 |
/**
|
36 |
* @var array $_args an array of plugin specific args
|
37 |
*/
|
38 |
protected $_args = array();
|
39 |
/**
|
40 |
* __get
|
41 |
* an alias for getOption
|
42 |
*
|
43 |
* @param string $arg
|
44 |
*/
|
45 |
public function __get($arg)
|
46 |
{
|
47 |
if (isset($this->_args[$arg])) {
|
48 |
return $this->_args[$arg];
|
49 |
}
|
50 |
return null;
|
51 |
}
|
52 |
/**
|
53 |
* __isset
|
54 |
*
|
55 |
* @param string $arg
|
56 |
*/
|
57 |
public function __isset($arg)
|
58 |
{
|
59 |
return isset($this->_args[$arg]);
|
60 |
}
|
61 |
/**
|
62 |
* sets given value to an argument
|
63 |
*
|
64 |
* @param $arg the name of the option to be changed
|
65 |
* @param $value the value of the option
|
66 |
* @return Doctrine_Validator_Driver this object
|
67 |
*/
|
68 |
public function __set($arg, $value)
|
69 |
{
|
70 |
$this->_args[$arg] = $value;
|
71 |
|
72 |
return $this;
|
73 |
}
|
74 |
/**
|
75 |
* returns the value of an argument
|
76 |
*
|
77 |
* @param $arg the name of the option to retrieve
|
78 |
* @return mixed the value of the option
|
79 |
*/
|
80 |
public function getArg($arg)
|
81 |
{
|
82 |
if ( ! isset($this->_args[$arg])) {
|
83 |
throw new Doctrine_Plugin_Exception('Unknown option ' . $arg);
|
84 |
}
|
85 |
|
86 |
return $this->_args[$arg];
|
87 |
}
|
88 |
/**
|
89 |
* sets given value to an argument
|
90 |
*
|
91 |
* @param $arg the name of the option to be changed
|
92 |
* @param $value the value of the option
|
93 |
* @return Doctrine_Validator_Driver this object
|
94 |
*/
|
95 |
public function setArg($arg, $value)
|
96 |
{
|
97 |
$this->_args[$arg] = $value;
|
98 |
|
99 |
return $this;
|
100 |
}
|
101 |
/**
|
102 |
* returns all args and their associated values
|
103 |
*
|
104 |
* @return array all args as an associative array
|
105 |
*/
|
106 |
public function getArgs()
|
107 |
{
|
108 |
return $this->_args;
|
109 |
}
|
110 |
} |