protected function loadTemplates()
	{
		$loader = new \Twig_Loader_Filesystem(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'templates');
		$this->twigEnv = new Twig_Environment($loader, ['cache' => false, 'debug' => true]);
		$this->twigEnv->addExtension(new Twig_Extension_Debug());

		// Custom filter for phpdoc
		$filter = new \Twig_Filter('phpdoc', function($string, $indentationCount = 0, $indentChar = "\t") {
			$result = str_repeat($indentChar, $indentationCount) . '/**' . "\n";
			// Split per line
			$lines = explode("\n", trim($string));
			foreach ($lines as $line) {
				$result .= str_repeat($indentChar, $indentationCount) . ' * ' . $line . "\n";
			}
			$result .= str_repeat($indentChar, $indentationCount) . ' */' . "\n";
			return $result;
		});

		$this->twigEnv->addFilter($filter);

		$this->managerTemplate = $this->twigEnv->load('manager.php.twig');
		$this->resourceTemplate = $this->twigEnv->load('resource.php.twig');
		$this->mainClientTemplate = $this->twigEnv->load('mainClient.php.twig');
		$this->mainExceptionTemplate = $this->twigEnv->load('mainException.php.twig');
		$this->unexpectedResponseExceptionTemplate = $this->twigEnv->load('unexpectedResponseException.php.twig');

		if (!is_null($this->testsOutputPath)) {
			$this->mainClientTestTemplate = $this->twigEnv->load('mainClientTest.php.twig');
			$this->managerTestTemplate = $this->twigEnv->load('managerTest.php.twig');
		}
	}
protected function loadTemplates()
	{
		$loader = new \Twig_Loader_Filesystem(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'templates');
		$this->twigEnv = new Twig_Environment($loader, ['cache' => false, 'debug' => true]);
		$this->twigEnv->addExtension(new Twig_Extension_Debug());

		// Custom filter for phpdoc
		$filter = new \Twig_Filter('phpdoc', function($string, $indentationCount = 0, $indentChar = "\t") {
			$result = str_repeat($indentChar, $indentationCount) . '/**' . "\n";
			// Split per line
			$lines = explode("\n", trim($string));
			foreach ($lines as $line) {
				$result .= str_repeat($indentChar, $indentationCount) . ' * ' . $line . "\n";
			}
			$result .= str_repeat($indentChar, $indentationCount) . ' */' . "\n";
			return $result;
		});

		$this->twigEnv->addFilter($filter);

		$this->managerTemplate = $this->twigEnv->load('manager.php.twig');
		$this->resourceTemplate = $this->twigEnv->load('resource.php.twig');
		$this->mainClientTemplate = $this->twigEnv->load('mainClient.php.twig');
		$this->mainExceptionTemplate = $this->twigEnv->load('mainException.php.twig');
		$this->unexpectedResponseExceptionTemplate = $this->twigEnv->load('unexpectedResponseException.php.twig');

		if (!is_null($this->testsOutputPath)) {
			$this->mainClientTestTemplate = $this->twigEnv->load('mainClientTest.php.twig');
			$this->managerTestTemplate = $this->twigEnv->load('managerTest.php.twig');
		}
	}
protected function loadTemplates ( ) { $ loader = new \ Twig_Loader_Filesystem ( dirname ( __FILE__ ) . DIRECTORY_SEPARATOR . 'templates' ) ; $ this -> twigEnv = new Twig_Environment ( $ loader , [ 'cache' => false , 'debug' => true ] ) ; $ this -> twigEnv -> addExtension ( new Twig_Extension_Debug ( ) ) ; // Custom filter for phpdoc
 $ filter = new \ Twig_Filter ( 'phpdoc' , function ( $ string , $ indentationCount = 0 , $ indentChar = "\t" ) { $ result = str_repeat ( $ indentChar , $ indentationCount ) . '/**' . "\n" ; // Split per line
 $ lines = explode ( "\n" , trim ( $ string ) ) ; foreach ( $ lines as $ line ) { $ result .= str_repeat ( $ indentChar , $ indentationCount ) . ' * ' . $ line . "\n" ; } $ result .= str_repeat ( $ indentChar , $ indentationCount ) . ' */' . "\n" ; return $ result ; } ) ; $ this -> twigEnv -> addFilter ( $ filter ) ; $ this -> managerTemplate = $ this -> twigEnv -> load ( 'manager.php.twig' ) ; $ this -> resourceTemplate = $ this -> twigEnv -> load ( 'resource.php.twig' ) ; $ this -> mainClientTemplate = $ this -> twigEnv -> load ( 'mainClient.php.twig' ) ; $ this -> mainExceptionTemplate = $ this -> twigEnv -> load ( 'mainException.php.twig' ) ; $ this -> unexpectedResponseExceptionTemplate = $ this -> twigEnv -> load ( 'unexpectedResponseException.php.twig' ) ; if ( ! is_null ( $ this -> testsOutputPath ) ) { $ this -> mainClientTestTemplate = $ this -> twigEnv -> load ( 'mainClientTest.php.twig' ) ; $ this -> managerTestTemplate = $ this -> twigEnv -> load ( 'managerTest.php.twig' ) ; } }
Load Twig templates filesystem and custom filters
Load Twig templates filesystem and custom filters