<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of ParametreManager
*
* @author Edmond
*/
namespace App\Services\param\Twig;
use App\Services\param\ParametreManager;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
use App\Types\param\TypeDonnees;
class ParametreManagerTwig extends AbstractExtension{
/*
* Service de gestion des parametres
*/
private $parametreManager;
public function __construct(ParametreManager $paramManager) {
$this->parametreManager = $paramManager;
}
public function getFunctions()
{
return array(
new TwigFunction('getValeurParametre', [$this, 'getValeurParametre']),
new TwigFunction('isBoolean', [$this, 'isBoolean']),
);
}
/*
*
* retoutne la valeur d'un parametre
*
* @author armand.tevi@gmail.com
* @copyright 2015
* @version 1
* @access public
* @param int $paramtreName
* @param boolean $objetDate
* @return
*/
public function getValeurParametre($paramtreName, $objetDate = 1, $paramRepository) {
return $this->parametreManager->getValeurParametre($paramtreName, $objetDate, $paramRepository);
}
/*
*
* VĂ©rifie si un type de parametre est un boolean
*
* @author armand.tevi@gmail.com
* @copyright 2015
* @version 1
* @access public
* @param int $typeDonnee
* @return boolean
*/
public function isBoolean($typeDonnee) {
return ($typeDonnee == TypeDonnees::BOOLEAN);
}
public function getName() {
return 'parametre_manager_twig';
}
}