Changeset 537
- Timestamp:
- 04/15/07 12:21:43 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/ipo/request/stubRequestValueError.php
r295 r537 2 2 /** 3 3 * Class containing error messages for request values. 4 * 4 * 5 5 * @author Frank Kleine <mikey@stubbles.net> 6 6 * @package stubbles … … 10 10 /** 11 11 * Class containing error messages for request values. 12 * 13 * This is mainly an internal class for the request package, a container for 12 * 13 * This is mainly an internal class for the request package, a container for 14 14 * error messages. The messages itself can contain value keys. These value 15 * keys are thought to be replaced with concrete values to customize the error 15 * keys are thought to be replaced with concrete values to customize the error 16 16 * message. 17 17 * 18 18 * @package stubbles 19 19 * @subpackage ipo_request 20 * @XMLTag(tagName= error)21 * @XMLMethods[XMLMatcher](pattern= /getId|getMessages/)20 * @XMLTag(tagName="error") 21 * @XMLMethods[XMLMatcher](pattern="/getId|getMessages/") 22 22 */ 23 23 class stubRequestValueError extends stubBaseObject … … 41 41 */ 42 42 protected $values = array(); 43 43 44 44 /** 45 45 * constructor … … 80 80 return isset($this->messages[$locale]); 81 81 } 82 82 83 83 /** 84 84 * returns the message for the given locale … … 95 95 $message = str_replace('{' . $key . '}', $this->flattenValue($value), $message); 96 96 } 97 97 98 98 return $message; 99 99 } 100 100 101 101 return null; 102 102 } 103 103 104 104 /** 105 105 * returns all messages 106 106 * 107 107 * @return array<string,string> 108 * @XMLTag(tagName= messages)108 * @XMLTag(tagName="messages") 109 109 */ 110 110 public function getMessages() … … 115 115 $message = str_replace('{' . $key . '}', $this->flattenValue($value), $message); 116 116 } 117 117 118 118 $messages[$locale] = $message; 119 119 } 120 120 121 121 return $messages; 122 122 } 123 123 124 124 /** 125 125 * flattens the given value to be used within the message … … 137 137 } 138 138 } 139 139 140 140 return (string) $value; 141 141 } 142 142 143 143 /** 144 144 * Sets the values that should replace the value keys within the messages. 145 * 146 * This method could be used in conjunction with the getCriteria() method 147 * of a validator: the return values of these mostly fit well to the 148 * required value keys. Returns itself for easy use in conjunction with 145 * 146 * This method could be used in conjunction with the getCriteria() method 147 * of a validator: the return values of these mostly fit well to the 148 * required value keys. Returns itself for easy use in conjunction with 149 149 * the factory. 150 150 * … … 160 160 throw new stubRequestValueErrorException('Value for key ' . $key . ' is missing.'); 161 161 } 162 162 163 163 $this->values[$key] = $values[$key]; 164 164 } 165 165 166 166 return $this; 167 167 } 168 168 169 169 /** 170 170 * returns a list of all value keys
