3 * Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
5 * This file is a part of Codendi.
7 * Codendi is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * Codendi is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Codendi. If not, see <http://www.gnu.org/licenses/>.
21 /* abstract */ class Codendi_Request {
26 var $_validated_input;
32 var $_last_access_to_input;
42 function Codendi_Request($params) {
43 $this->params = $params;
44 $this->_validated_input = array();
45 $this->_last_access_to_input = array();
50 * Get the value of $variable in $this->params (user submitted values).
52 * @param string $variable Name of the parameter to get.
53 * @return mixed If the variable exist, the value is returned (string)
54 * otherwise return false;
56 function get($variable) {
58 return $this->_get($variable, $this->params);
62 * Add a param and/or set its value
65 function set($name, $value) {
66 $this->params[$name] = $value;
71 * Get the value of $variable in $array.
74 * @param string $variable Name of the parameter to get.
75 * @param array $array Name of the parameter to get.
77 function _get($variable, $array) {
78 if ($this->_exist($variable, $array)) {
79 return $array[$variable];
86 * Check if $variable exists in user submitted parameters.
88 * @param string $variable Name of the parameter.
91 function exist($variable) {
92 return $this->_exist($variable, $this->params);
96 * Check if $variable exists in $array.
99 * @param string $variable Name of the parameter.
102 function _exist($variable, $array) {
103 return isset($array[$variable]);