setRegex($regex); } public function parseValue ($arg) { if(!preg_match($this->regex, $arg, $matches)) throw new InvalidArgument($arg, 'La valeur ne correspond pas au motif attendu'); return $matches; } public function getValueDescription () { return $this->getRegex(); } /** * Le motif à respecter * * @return string Le motif * * @see $_regex */ public function getRegex() { return $this->_regex; } /** * Modifie le motif à respecter * * @param string $regex Le nouveau motif * * @return $this */ public function setRegex($regex = null) { $this->_regex = $regex; return $this; } }