123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace WebserviceBundle\Twig;
- use WebserviceBundle\Services\Webservice;
- class RemoteClientExtension extends \Twig_Extension
- {
-
- /**
- * @var Webservice
- */
- protected $webservice;
-
-
- /**
- * @param Webservice $webservice
- */
- public function __construct(Webservice $webservice)
- {
- $this->webservice = $webservice;
- }
- /**
- * @return array
- */
- public function getFunctions()
- {
- return array(
- new \Twig_SimpleFunction('remote_client', array($this, 'getClient')),
- );
- }
- /**
- * @param int $clientId
- * @return string
- */
- public function getClient($clientId)
- {
- return $this->webservice->getById('client', $clientId);
- }
- /**
- * @return string
- */
- public function getName()
- {
- return 'remote_client_extension';
- }
- }
|