@@ 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 |
@@ 54-62 (lines=9) @@ | ||
51 | } |
|
52 | ||
53 | protected function ctrl($name, $value, $typeCtrl) { |
|
54 | if (\is_array($typeCtrl)) { |
|
55 | if (array_search($value, $typeCtrl) === false) { |
|
56 | throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}"); |
|
57 | } |
|
58 | } else { |
|
59 | if (!$typeCtrl($value)) { |
|
60 | throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name); |
|
61 | } |
|
62 | } |
|
63 | return true; |
|
64 | } |
|
65 |