| @@ 59-66 (lines=8) @@ | ||
| 56 | } | |
| 57 | ||
| 58 | 	protected function setParamCtrl($key, $value, $typeCtrl) { | |
| 59 | 		if (is_array($typeCtrl)) { | |
| 60 | if (array_search($value, $typeCtrl)===false) | |
| 61 | 				throw new \Exception("La valeur passée a propriété `".$key."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); | |
| 62 | 		} else { | |
| 63 | 			if (!$typeCtrl($value)) { | |
| 64 | 				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key); | |
| 65 | } | |
| 66 | } | |
| 67 | $this->setParam($key, $value); | |
| 68 | } | |
| 69 | ||
| @@ 101-109 (lines=9) @@ | ||
| 98 | } | |
| 99 | ||
| 100 | 	protected function ctrl($name, $value, $typeCtrl) { | |
| 101 | 		if (is_array($typeCtrl)) { | |
| 102 | 			if (array_search($value, $typeCtrl) === false) { | |
| 103 | 				throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}"); | |
| 104 | } | |
| 105 | 		} else { | |
| 106 | 			if (!$typeCtrl($value)) { | |
| 107 | 				throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name); | |
| 108 | } | |
| 109 | } | |
| 110 | return true; | |
| 111 | } | |
| 112 | ||