@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @param \Twig_Environment $env Twig environment object |
| 29 | 29 | */ |
| 30 | - public function __construct( \Twig_Environment $env ) |
|
| 30 | + public function __construct(\Twig_Environment $env) |
|
| 31 | 31 | { |
| 32 | 32 | $this->env = $env; |
| 33 | 33 | } |
@@ -42,33 +42,33 @@ discard block |
||
| 42 | 42 | * @return string Output generated by the template |
| 43 | 43 | * @throws \Aimeos\MW\View\Exception If the template isn't found |
| 44 | 44 | */ |
| 45 | - public function render( \Aimeos\MW\View\Iface $view, $filename, array $values ) |
|
| 45 | + public function render(\Aimeos\MW\View\Iface $view, $filename, array $values) |
|
| 46 | 46 | { |
| 47 | 47 | $loader = $this->env->getLoader(); |
| 48 | 48 | |
| 49 | - if( ( $content = @file_get_contents( $filename ) ) === false ) { |
|
| 50 | - throw new \Aimeos\MW\View\Exception( sprintf( 'Template "%1$s" not found', $filename ) ); |
|
| 49 | + if (($content = @file_get_contents($filename)) === false) { |
|
| 50 | + throw new \Aimeos\MW\View\Exception(sprintf('Template "%1$s" not found', $filename)); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $custom = new \Twig_Loader_Array( array( $filename => $content ) ); |
|
| 54 | - $this->env->setLoader( new \Twig_Loader_Chain( array( $custom, $loader ) ) ); |
|
| 53 | + $custom = new \Twig_Loader_Array(array($filename => $content)); |
|
| 54 | + $this->env->setLoader(new \Twig_Loader_Chain(array($custom, $loader))); |
|
| 55 | 55 | |
| 56 | 56 | try |
| 57 | 57 | { |
| 58 | - $template = $this->env->loadTemplate( $filename ); |
|
| 59 | - $content = $template->render( $values ); |
|
| 58 | + $template = $this->env->loadTemplate($filename); |
|
| 59 | + $content = $template->render($values); |
|
| 60 | 60 | |
| 61 | - foreach( $template->getBlockNames( $values ) as $key ) { |
|
| 62 | - $view->block()->set( str_replace( '_', '/', $key ), $template->renderBlock( $key, $values ) ); |
|
| 61 | + foreach ($template->getBlockNames($values) as $key) { |
|
| 62 | + $view->block()->set(str_replace('_', '/', $key), $template->renderBlock($key, $values)); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - $this->env->setLoader( $loader ); |
|
| 65 | + $this->env->setLoader($loader); |
|
| 66 | 66 | |
| 67 | 67 | return $content; |
| 68 | 68 | } |
| 69 | - catch( \Exception $e ) |
|
| 69 | + catch (\Exception $e) |
|
| 70 | 70 | { |
| 71 | - $this->env->setLoader( $loader ); |
|
| 71 | + $this->env->setLoader($loader); |
|
| 72 | 72 | throw $e; |
| 73 | 73 | } |
| 74 | 74 | } |