Completed
Push — master ( 8ba53b...895e90 )
by Tolan
06:16
created
lib/Template/PhpTemplate.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
     }
99 99
 
100 100
     /**
101
-     * @param $templatePath
101
+     * @param string $templatePath
102 102
      * @return null|string
103 103
      * @throws \Exception
104 104
      */
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
         $templatePath = null,
52 52
         $templateString = null,
53 53
         ResourceRepository $repo = null
54
-    ){
55
-        parent::__construct( $component );
54
+    ) {
55
+        parent::__construct($component);
56 56
         $this->templatePath = $templatePath;
57 57
         $this->templateString = $templateString;
58 58
         // Optional Puli repo
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      * @return Response
66 66
      * @throws \Exception
67 67
      */
68
-    protected function doRender( ViewState $state, array $props = [ ] )
68
+    protected function doRender(ViewState $state, array $props = [ ])
69 69
     {
70 70
         // Available variables in template file are:
71 71
         // $state
@@ -81,20 +81,20 @@  discard block
 block discarded – undo
81 81
         /** @noinspection PhpUnusedLocalVariableInspection */
82 82
         $exec = $this->component->exec;
83 83
         if ($this->templatePath) {
84
-            $realPath = $this->getRealTemplatePath( $this->templatePath );
84
+            $realPath = $this->getRealTemplatePath($this->templatePath);
85 85
             ob_start();
86 86
             /** @noinspection PhpIncludeInspection */
87
-            include( $realPath );
87
+            include($realPath);
88 88
             $rendered = ob_get_clean();
89 89
         }elseif ($this->templateString) {
90 90
             ob_start();
91
-            eval( "?>" . $this->templateString );
91
+            eval("?>" . $this->templateString);
92 92
             $rendered = ob_get_clean();
93 93
         }else {
94
-            throw new \Exception( "Neither valid template path no valid template string passed to PhpTemplate." );
94
+            throw new \Exception("Neither valid template path no valid template string passed to PhpTemplate.");
95 95
         }
96 96
 
97
-        return new Response( "text/html", $rendered );
97
+        return new Response("text/html", $rendered);
98 98
     }
99 99
 
100 100
     /**
@@ -102,18 +102,18 @@  discard block
 block discarded – undo
102 102
      * @return null|string
103 103
      * @throws \Exception
104 104
      */
105
-    private function getRealTemplatePath( $templatePath )
105
+    private function getRealTemplatePath($templatePath)
106 106
     {
107 107
         if ($this->repo instanceof ResourceRepository) {
108
-            if ($this->repo->contains( $templatePath )) {
109
-                return $this->repo->get( $templatePath )
108
+            if ($this->repo->contains($templatePath)) {
109
+                return $this->repo->get($templatePath)
110 110
                     ->getPath();
111 111
             }
112 112
         }
113
-        if (file_exists( $templatePath )) {
113
+        if (file_exists($templatePath)) {
114 114
             return $templatePath;
115 115
         }
116
-        throw new \Exception( "Template path not found in repository or on filesystem: {$templatePath}, in PhpTemplate" );
116
+        throw new \Exception("Template path not found in repository or on filesystem: {$templatePath}, in PhpTemplate");
117 117
     }
118 118
 
119 119
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -86,11 +86,11 @@
 block discarded – undo
86 86
             /** @noinspection PhpIncludeInspection */
87 87
             include( $realPath );
88 88
             $rendered = ob_get_clean();
89
-        }elseif ($this->templateString) {
89
+        } elseif ($this->templateString) {
90 90
             ob_start();
91 91
             eval( "?>" . $this->templateString );
92 92
             $rendered = ob_get_clean();
93
-        }else {
93
+        } else {
94 94
             throw new \Exception( "Neither valid template path no valid template string passed to PhpTemplate." );
95 95
         }
96 96
 
Please login to merge, or discard this patch.