webservice = $webservice; $this->remoteClientCreateUrl = $remoteClientCreateUrl; } /** * @return array */ public function getFunctions() { return array( new \Twig_SimpleFunction('remote_client', array($this, 'getClient')), new \Twig_SimpleFunction('remote_client_url', array($this, 'getClientCreateUrl')), ); } /** * @param int $clientId * * @return string */ public function getClient($clientId) { return $this->webservice->getById('client', $clientId); } /** * @return string */ public function getClientCreateUrl() { $url = HttpUtils::cleanUrl($this->remoteClientCreateUrl); if ($url == '' || filter_var($url, FILTER_VALIDATE_URL) === false) { return '#'; } return $url; } /** * @return string */ public function getName() { return 'remote_client_extension'; } }