diff --git a/config/unicaen-parametre.global.php.dist b/config/unicaen-parametre.global.php.dist index b3edde01e1f71b270941df1ad62bb5129de6c736..17fd96069728f32cf7b137de0c6d4530f497150c 100644 --- a/config/unicaen-parametre.global.php.dist +++ b/config/unicaen-parametre.global.php.dist @@ -2,18 +2,7 @@ namespace UnicaenParametre; -use UnicaenParametre\Controller\CategorieController; -use UnicaenParametre\Controller\CategorieControllerFactory; -use UnicaenParametre\Form\Categorie\CategorieForm; -use UnicaenParametre\Form\Categorie\CategorieFormFactory; -use UnicaenParametre\Form\Categorie\CategorieHydrator; -use UnicaenParametre\Form\Categorie\CategorieHydratorFactory; use UnicaenParametre\Provider\Privilege\ParametrecategoriePrivileges; -use UnicaenParametre\Service\Categorie\CategorieService; -use UnicaenParametre\Service\Categorie\CategorieServiceFactory; -use UnicaenPrivilege\Guard\PrivilegeController; -use Laminas\Router\Http\Literal; -use Laminas\Router\Http\Segment; return [ diff --git a/readme.md b/readme.md index 4dc1dee2f6531c2c35712ea9a676aaaed2c825ee..aefd6bd477348bc9bc1a861968cb413ca37180e3 100644 --- a/readme.md +++ b/readme.md @@ -1,40 +1,64 @@ UnicaenParametre ============ -UnicaenParametre est une biltiothèque de gestion de catégories de paramètre et de paramètres. +UnicaenParametre est une bibliothèque de gestion de paramètres. +Les paramètres sont désignés par une catégorie et un code. -Route d'accès -------------- -- */parametre/index* donne accès aux paramètres de toutes les catégories -- */parametre/index/categorieId* donne accès aux paramètres de la catégorie *categorieId* +Le module fournit un menu d'administration permettant la déclaration des paramètres et de leur catégorie, +ainsi que l'affectation de leur valeur. Récupération de la valeur d'un paramètre ---------------------------------------- + ```php -$this->getParametreService()->getParametreByCode('ma_categorie','mon_parametre')->getValeur(); +$this->getParametreService()->getValeurForParametre('ma_categorie','mon_parametre'); ``` -**N.B.:** Il n'y a pas d'historisation des paramètres ou de leur catégorie. Est-ce bien nécessaire ? +Si le paramètre n'est pas trouvé alors une exception ```ParametreNotFoundException``` est lancée. + +Bonnes pratiques +---------------- + +Afin de mieux référencer les catégories et les paramètres, il est recommandé de mettre en place un provider de parametres déclarant en constante : la catégorie et les paramètres. + +```php +<?php + +namespace Formation\Provider\Parametre; + +class FormationParametres { + + const CATEGORIE = 'FORMATION'; + + const NB_PLACE_PRINCIPALE = 'NB_PLACE_PRINCIPALE'; + const NB_PLACE_COMPLEMENTAIRE = 'NB_PLACE_COMPLEMENTAIRE'; +} +``` - - - - - - - - - - - - - + Installation ============ Dans le répertoire **doc** du module, on retrouve le fichier *database.sql* qui permet de construire la table associée au module et d'ajouter les privilèges associés. - -Le module s'attend à avoir un menu **Administration** pour mettre un menu secondaire **Paramètres**. -Pensez à l'ajouter s'il n'existe pas ou à modifier la naviguation dans *categorie.config.php*. + +La navigation est fourni par le fichier ```unicaen-parametre.global.php(.dist)``` et doit être adaptée à votre application. - - - - - - - - - - - - - -Historique + +ChangeLog ========== -version 0.1.0 25/02/2021 ------------------------- -Version initiale du module. +**5.0.1** +- Ajout de la fonction de la valeur dans le service ParametreService +- Ajout de l'exception ```ParametreNotFoundException``` +- Transformation des classes des entités *à la PHP8* + +**5.0.0** +- Finalisation de la migration à BootStrap 5. Améliorations possibles ----------------------- diff --git a/src/UnicaenParametre/Controller/CategorieController.php b/src/UnicaenParametre/Controller/CategorieController.php index 44417f422d910b07e167ee76d78edb4ff81350f9..adf6ca55fb4dddaf320906f84802ce9f332322b7 100644 --- a/src/UnicaenParametre/Controller/CategorieController.php +++ b/src/UnicaenParametre/Controller/CategorieController.php @@ -14,7 +14,7 @@ class CategorieController extends AbstractActionController { use ParametreServiceAwareTrait; use CategorieFormAwareTrait; - public function indexAction() + public function indexAction() : ViewModel { $categories = $this->getCategorieService()->getCategories(); $parametres = $this->getParametreService()->getParametres(); @@ -27,7 +27,8 @@ class CategorieController extends AbstractActionController { ]); } - public function ajouterAction() { + public function ajouterAction() : ViewModel + { $categorie = new Categorie(); $form = $this->getCategorieForm(); @@ -51,7 +52,7 @@ class CategorieController extends AbstractActionController { return $vm; } - public function modifierAction() + public function modifierAction() : ViewModel { $categorie = $this->getCategorieService()->getRequestedCategorie($this); $form = $this->getCategorieForm(); @@ -76,7 +77,7 @@ class CategorieController extends AbstractActionController { return $vm; } - public function supprimerAction() + public function supprimerAction() : ViewModel { $categorie = $this->getCategorieService()->getRequestedCategorie($this); diff --git a/src/UnicaenParametre/Controller/CategorieControllerFactory.php b/src/UnicaenParametre/Controller/CategorieControllerFactory.php index 9c68897f94f43a3299d80db67742ee0054d7fcf7..fc93b57320b8f10785efa24873a4336f0d939a53 100644 --- a/src/UnicaenParametre/Controller/CategorieControllerFactory.php +++ b/src/UnicaenParametre/Controller/CategorieControllerFactory.php @@ -3,13 +3,21 @@ namespace UnicaenParametre\Controller; use Interop\Container\ContainerInterface; +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\NotFoundExceptionInterface; use UnicaenParametre\Form\Categorie\CategorieForm; use UnicaenParametre\Service\Categorie\CategorieService; use UnicaenParametre\Service\Parametre\ParametreService; class CategorieControllerFactory { - public function __invoke(ContainerInterface $container) + /** + * @param ContainerInterface $container + * @return CategorieController + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function __invoke(ContainerInterface $container) : CategorieController { /** * @var CategorieService $categorieService diff --git a/src/UnicaenParametre/Controller/ParametreController.php b/src/UnicaenParametre/Controller/ParametreController.php index 36b5c821f18c4c256e9bc97393de1bab27709dea..f53f7c1a52e9b5fdd669b7d67e82b298e30b5cfb 100644 --- a/src/UnicaenParametre/Controller/ParametreController.php +++ b/src/UnicaenParametre/Controller/ParametreController.php @@ -14,7 +14,7 @@ class ParametreController extends AbstractActionController { use ParametreServiceAwareTrait; use ParametreFormAwareTrait; - public function ajouterAction() + public function ajouterAction() : ViewModel { $categorie = $this->getCategorieService()->getRequestedCategorie($this); $parametre = new Parametre(); @@ -41,7 +41,7 @@ class ParametreController extends AbstractActionController { return $vm; } - public function modifierAction() + public function modifierAction() : ViewModel { $parametre = $this->getParametreService()->getRequestedParametre($this); $form = $this->getParametreForm(); @@ -67,7 +67,7 @@ class ParametreController extends AbstractActionController { return $vm; } - public function supprimerAction() + public function supprimerAction() : ViewModel { $parametre = $this->getParametreService()->getRequestedParametre($this); @@ -90,7 +90,7 @@ class ParametreController extends AbstractActionController { return $vm; } - public function modifierValeurAction() + public function modifierValeurAction() : ViewModel { $parametre = $this->getParametreService()->getRequestedParametre($this); diff --git a/src/UnicaenParametre/Controller/ParametreControllerFactory.php b/src/UnicaenParametre/Controller/ParametreControllerFactory.php index 8bbc5e00ca5ab037ae9ee9a3aae1567abb7f04df..c73a898e599d904e35f03d3b93fb538f45220a27 100644 --- a/src/UnicaenParametre/Controller/ParametreControllerFactory.php +++ b/src/UnicaenParametre/Controller/ParametreControllerFactory.php @@ -3,6 +3,8 @@ namespace UnicaenParametre\Controller; use Interop\Container\ContainerInterface; +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\NotFoundExceptionInterface; use UnicaenParametre\Form\Parametre\ParametreForm; use UnicaenParametre\Service\Categorie\CategorieService; use UnicaenParametre\Service\Parametre\ParametreService; @@ -12,8 +14,10 @@ class ParametreControllerFactory { /** * @param ContainerInterface $container * @return ParametreController + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface */ - public function __invoke(ContainerInterface $container) + public function __invoke(ContainerInterface $container) : ParametreController { /** * @var CategorieService $categorieService diff --git a/src/UnicaenParametre/Entity/Db/Categorie.php b/src/UnicaenParametre/Entity/Db/Categorie.php index 49cc9fb745e1ed4ab2d244ada9251479f5956fda..bce4cfb41fbc01561386442e432e10a4a7f9a578 100644 --- a/src/UnicaenParametre/Entity/Db/Categorie.php +++ b/src/UnicaenParametre/Entity/Db/Categorie.php @@ -6,91 +6,55 @@ class Categorie { const DEFAULT_ORDER = 9999; - /** @var integer */ - private $id; - /** @var string */ - private $code; - /** @var string */ - private $libelle; - /** @var string */ - private $description; - /** @var integer */ - private $ordre; + private ?int $id = null; + private ?string $code = null; + private ?string $libelle = null; + private ?string $description = null; + private ?int $ordre = null; - /** - * @return int - */ public function getId(): int { return $this->id; } - /** - * @return string|null - */ public function getCode(): ?string { return $this->code; } - /** - * @param string|null $code - * @return Categorie - */ public function setCode(?string $code): Categorie { $this->code = $code; return $this; } - /** - * @return string|null - */ public function getLibelle(): ?string { return $this->libelle; } - /** - * @param string|null $libelle - * @return Categorie - */ public function setLibelle(?string $libelle): Categorie { $this->libelle = $libelle; return $this; } - /** - * @return string|null - */ public function getDescription(): ?string { return $this->description; } - /** - * @param string|null $description - * @return Categorie - */ public function setDescription(?string $description): Categorie { $this->description = $description; return $this; } - /** - * @return int|null - */ public function getOrdre(): ?int { return $this->ordre; } - /** - * @param int $ordre - * @return Categorie - */ public function setOrdre(int $ordre = Categorie::DEFAULT_ORDER): Categorie { $this->ordre = $ordre; diff --git a/src/UnicaenParametre/Entity/Db/Parametre.php b/src/UnicaenParametre/Entity/Db/Parametre.php index 85b31397ebdea9b36f49da6d34ad9062d8161b24..2ca7cc2fd7c23297ff397594965159f0cb235f90 100644 --- a/src/UnicaenParametre/Entity/Db/Parametre.php +++ b/src/UnicaenParametre/Entity/Db/Parametre.php @@ -6,151 +6,95 @@ class Parametre { const DEFAULT_ORDER = 9999; - /** @var integer */ - private $id; - /** @var Categorie */ - private $categorie; - /** @var string */ - private $code; - /** @var string */ - private $libelle; - /** @var string */ - private $description; - /** @var string */ - private $valeur; - /** @var string */ - private $valeurs_possibles; - /** @var integer */ - private $ordre; - - /** - * @return int - */ + const TYPE_STRING = "String"; + const TYPE_BOOLEAN = "Boolean"; + const TYPE_NUMBER = "Number"; + + private ?int $id = null; + private ?Categorie $categorie = null; + private ?string $code = null; + private ?string $libelle = null; + private ?string $description = null; + private ?string $valeur = null; + private ?string $valeurs_possibles = null; + private ?int $ordre = null; + public function getId(): int { return $this->id; } - /** - * @return Categorie|null - */ public function getCategorie(): ?Categorie { return $this->categorie; } - /** - * @param Categorie|null $categorie - * @return Parametre - */ public function setCategorie(?Categorie $categorie): Parametre { $this->categorie = $categorie; return $this; } - /** - * @return string|null - */ public function getCode(): ?string { return $this->code; } - /** - * @param string|null $code - * @return Parametre - */ public function setCode(?string $code): Parametre { $this->code = $code; return $this; } - /** - * @return string|null - */ public function getLibelle(): ?string { return $this->libelle; } - /** - * @param string|null $libelle - * @return Parametre - */ public function setLibelle(?string $libelle): Parametre { $this->libelle = $libelle; return $this; } - /** - * @return string|null - */ public function getDescription(): ?string { return $this->description; } - /** - * @param string|null $description - * @return Parametre - */ public function setDescription(?string $description): Parametre { $this->description = $description; return $this; } - /** - * @return string|null - */ public function getValeur(): ?string { return $this->valeur; } - /** - * @param string|null $valeur - * @return Parametre - */ public function setValeur(?string $valeur): Parametre { $this->valeur = $valeur; return $this; } - /** - * @return string|null - */ public function getValeursPossibles(): ?string { return $this->valeurs_possibles; } - /** - * @param string|null $valeurs_possibles - * @return Parametre - */ public function setValeursPossibles(?string $valeurs_possibles): Parametre { $this->valeurs_possibles = $valeurs_possibles; return $this; } - /** - * @return int|null - */ public function getOrdre(): ?int { return $this->ordre; } - /** - * @param int $ordre - * @return Parametre - */ public function setOrdre(int $ordre = Parametre::DEFAULT_ORDER): Parametre { $this->ordre = $ordre; diff --git a/src/UnicaenParametre/Exception/ParametreMalTypeException.php b/src/UnicaenParametre/Exception/ParametreMalTypeException.php new file mode 100644 index 0000000000000000000000000000000000000000..8166bd7a873acc6dddcc89a3087318bf729d1475 --- /dev/null +++ b/src/UnicaenParametre/Exception/ParametreMalTypeException.php @@ -0,0 +1,7 @@ +<?php + +namespace parametre\src\UnicaenParametre\Exception; + +use Exception; + +class ParametreMalTypeException extends Exception {} \ No newline at end of file diff --git a/src/UnicaenParametre/Exception/ParametreNotFoundException.php b/src/UnicaenParametre/Exception/ParametreNotFoundException.php new file mode 100644 index 0000000000000000000000000000000000000000..e42a1070dbdfe3d061d6d97feecd6cf09576477a --- /dev/null +++ b/src/UnicaenParametre/Exception/ParametreNotFoundException.php @@ -0,0 +1,7 @@ +<?php + +namespace UnicaenParametre\Exception; + +use Exception; + +class ParametreNotFoundException extends Exception {} \ No newline at end of file diff --git a/src/UnicaenParametre/Form/Categorie/CategorieFormAwareTrait.php b/src/UnicaenParametre/Form/Categorie/CategorieFormAwareTrait.php index 4d4ee6b053a263f6e01d72f574ccdebd21c34b08..e61ff38195ae889ab4a63cd7f770c03ac6777305 100644 --- a/src/UnicaenParametre/Form/Categorie/CategorieFormAwareTrait.php +++ b/src/UnicaenParametre/Form/Categorie/CategorieFormAwareTrait.php @@ -4,24 +4,15 @@ namespace UnicaenParametre\Form\Categorie; trait CategorieFormAwareTrait { - /** @var CategorieForm */ - private $categorieForm; + private CategorieForm $categorieForm; - /** - * @return CategorieForm - */ public function getCategorieForm(): CategorieForm { return $this->categorieForm; } - /** - * @param CategorieForm $categorieForm - * @return CategorieForm - */ - public function setCategorieForm(CategorieForm $categorieForm): CategorieForm + public function setCategorieForm(CategorieForm $categorieForm): void { $this->categorieForm = $categorieForm; - return $this->categorieForm; } } \ No newline at end of file diff --git a/src/UnicaenParametre/Form/Categorie/CategorieFormFactory.php b/src/UnicaenParametre/Form/Categorie/CategorieFormFactory.php index 8233d980c3e15c57e5d19d957375864ea987eeaf..541e82d12150972778642c13cb7db60afe051b35 100644 --- a/src/UnicaenParametre/Form/Categorie/CategorieFormFactory.php +++ b/src/UnicaenParametre/Form/Categorie/CategorieFormFactory.php @@ -3,6 +3,8 @@ namespace UnicaenParametre\Form\Categorie; use Interop\Container\ContainerInterface; +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\NotFoundExceptionInterface; use UnicaenParametre\Service\Categorie\CategorieService; class CategorieFormFactory { @@ -10,8 +12,10 @@ class CategorieFormFactory { /** * @param ContainerInterface $container * @return CategorieForm + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface */ - public function __invoke(ContainerInterface $container) + public function __invoke(ContainerInterface $container) : CategorieForm { /** * @var CategorieService $categorieService diff --git a/src/UnicaenParametre/Form/Categorie/CategorieHydrator.php b/src/UnicaenParametre/Form/Categorie/CategorieHydrator.php index b8c7cc6631ab59d32571786ed2c3681a0c32a330..48e53152218f2df5c497737714bc00f68bf29369 100644 --- a/src/UnicaenParametre/Form/Categorie/CategorieHydrator.php +++ b/src/UnicaenParametre/Form/Categorie/CategorieHydrator.php @@ -27,7 +27,7 @@ class CategorieHydrator implements HydratorInterface { * @param Categorie $object * @return Categorie */ - public function hydrate(array $data, $object) + public function hydrate(array $data, $object) : object { $code = (isset($data['code']) and trim($data['code']) !== '')?trim($data['code']):null; $libelle = (isset($data['libelle']) and trim($data['libelle']) !== '')?trim($data['libelle']):null; diff --git a/src/UnicaenParametre/Form/Categorie/CategorieHydratorFactory.php b/src/UnicaenParametre/Form/Categorie/CategorieHydratorFactory.php index 917af1722d533e1f70c2f3fd05d9a44ae2078750..ca90fce99313c059559341c02666faf66d902386 100644 --- a/src/UnicaenParametre/Form/Categorie/CategorieHydratorFactory.php +++ b/src/UnicaenParametre/Form/Categorie/CategorieHydratorFactory.php @@ -10,7 +10,7 @@ class CategorieHydratorFactory { * @param ContainerInterface $container * @return CategorieHydrator */ - public function __invoke(ContainerInterface $container) + public function __invoke(ContainerInterface $container) : CategorieHydrator { $hydrator = new CategorieHydrator(); return $hydrator; diff --git a/src/UnicaenParametre/Form/Parametre/ParametreFormAwareTrait.php b/src/UnicaenParametre/Form/Parametre/ParametreFormAwareTrait.php index fa9fb56fd8a529522861cdac8e8804342b61f7fe..97e027cd0bd2d8b4720cfaaf5c5aba9f70fdc3b4 100644 --- a/src/UnicaenParametre/Form/Parametre/ParametreFormAwareTrait.php +++ b/src/UnicaenParametre/Form/Parametre/ParametreFormAwareTrait.php @@ -4,24 +4,15 @@ namespace UnicaenParametre\Form\Parametre; trait ParametreFormAwareTrait { - /** @var ParametreForm */ - private $parametreForm; + private ParametreForm $parametreForm; - /** - * @return ParametreForm - */ public function getParametreForm(): ParametreForm { return $this->parametreForm; } - /** - * @param ParametreForm $parametreForm - * @return ParametreForm - */ - public function setParametreForm(ParametreForm $parametreForm): ParametreForm + public function setParametreForm(ParametreForm $parametreForm): void { $this->parametreForm = $parametreForm; - return $this->parametreForm; } } \ No newline at end of file diff --git a/src/UnicaenParametre/Form/Parametre/ParametreFormFactory.php b/src/UnicaenParametre/Form/Parametre/ParametreFormFactory.php index 1a425c7cd86e6b731eb452e600e378ca3bd03652..4a7f14c99b81e9a1010ee6635d79fdb6981d19ab 100644 --- a/src/UnicaenParametre/Form/Parametre/ParametreFormFactory.php +++ b/src/UnicaenParametre/Form/Parametre/ParametreFormFactory.php @@ -3,11 +3,19 @@ namespace UnicaenParametre\Form\Parametre; use Interop\Container\ContainerInterface; +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\NotFoundExceptionInterface; use UnicaenParametre\Service\Parametre\ParametreService; class ParametreFormFactory { - public function __invoke(ContainerInterface $container) + /** + * @param ContainerInterface $container + * @return ParametreForm + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function __invoke(ContainerInterface $container) : ParametreForm { /** * @var ParametreService $parametreService diff --git a/src/UnicaenParametre/Form/Parametre/ParametreHydrator.php b/src/UnicaenParametre/Form/Parametre/ParametreHydrator.php index 04a7ca681c075bd543078f3d94b418293abafbf2..6608fe0ec314a46125fa243ed8e9c523a64fa12d 100644 --- a/src/UnicaenParametre/Form/Parametre/ParametreHydrator.php +++ b/src/UnicaenParametre/Form/Parametre/ParametreHydrator.php @@ -28,7 +28,7 @@ class ParametreHydrator implements HydratorInterface { * @param Parametre $object * @return Parametre */ - public function hydrate(array $data, $object) + public function hydrate(array $data, $object) : object { $code = (isset($data['code']) and trim($data['code']) !== '')?trim($data['code']):null; $libelle = (isset($data['libelle']) and trim($data['libelle']) !== '')?trim($data['libelle']):null; diff --git a/src/UnicaenParametre/Form/Parametre/ParametreHydratorFactory.php b/src/UnicaenParametre/Form/Parametre/ParametreHydratorFactory.php index d47450e42ff4944f258134227ef28fbc0385bc8b..5808b05af9a8ee8c430ce8f7723bbffc8c57c899 100644 --- a/src/UnicaenParametre/Form/Parametre/ParametreHydratorFactory.php +++ b/src/UnicaenParametre/Form/Parametre/ParametreHydratorFactory.php @@ -10,7 +10,7 @@ class ParametreHydratorFactory { * @param ContainerInterface $container * @return ParametreHydrator */ - public function __invoke(ContainerInterface $container) + public function __invoke(ContainerInterface $container) : ParametreHydrator { $hydrator = new ParametreHydrator(); return $hydrator; diff --git a/src/UnicaenParametre/Service/Parametre/ParametreService.php b/src/UnicaenParametre/Service/Parametre/ParametreService.php index 3abf220965bed55d87426e102a1648851b5a85f7..9977529191a63b9810c016109104500dbcbbbf93 100644 --- a/src/UnicaenParametre/Service/Parametre/ParametreService.php +++ b/src/UnicaenParametre/Service/Parametre/ParametreService.php @@ -6,10 +6,12 @@ use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\ORMException; use Doctrine\ORM\QueryBuilder; use DoctrineModule\Persistence\ProvidesObjectManager; +use parametre\src\UnicaenParametre\Exception\ParametreMalTypeException; use RuntimeException; use UnicaenParametre\Entity\Db\Categorie; use UnicaenParametre\Entity\Db\Parametre; use Laminas\Mvc\Controller\AbstractActionController; +use UnicaenParametre\Exception\ParametreNotFoundException; class ParametreService { @@ -145,7 +147,7 @@ class ParametreService * @param string $param * @return Parametre */ - public function getRequestedParametre(AbstractActionController $controller, string $param = 'parametre') + public function getRequestedParametre(AbstractActionController $controller, string $param = 'parametre') : ?Parametre { $id = $controller->params()->fromRoute($param); /** @var Parametre $parametre */ @@ -153,4 +155,22 @@ class ParametreService return $parametre; } + /** FACADE ********************************************************************************************************/ + + /** + * @throws ParametreNotFoundException + * @throws ParametreMalTypeException + */ + public function getValeurForParametre(string $categorieCode, string $parametreCode) + { + $parametre = $this->getParametreByCode($categorieCode, $parametreCode); + if ($parametre === null) { + throw new ParametreNotFoundException("Aucun paramètre de trouvé pour les codes [Categorie: ".$categorieCode.",Parametre: ".$parametreCode."]"); + } + if ($parametre->getValeursPossibles() === Parametre::TYPE_STRING) return $parametre->getValeur(); + if ($parametre->getValeursPossibles() === Parametre::TYPE_BOOLEAN) return ($parametre->getValeur() === true); + if ($parametre->getValeursPossibles() === Parametre::TYPE_NUMBER) return ((int) $parametre->getValeur()); + + throw new ParametreMalTypeException("Le type [".$parametre->getValeursPossibles()."] du paramètre [Categorie: ".$categorieCode.",Parametre: ".$parametreCode."] est non géré"); + } } \ No newline at end of file