Completed
Push — feature/0.7.0 ( 38440f...02d6a4 )
by Ryuichi
07:28
created
WebStream/Annotation/Validate.php 1 patch
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace WebStream\Annotation;
3 3
 
4
-use WebStream\Core\CoreInterface;
5 4
 use WebStream\Annotation\Base\Annotation;
6 5
 use WebStream\Annotation\Base\IAnnotatable;
7 6
 use WebStream\Annotation\Base\IMethod;
@@ -10,7 +9,6 @@  discard block
 block discarded – undo
10 9
 use WebStream\Module\Utility\CommonUtils;
11 10
 use WebStream\Module\Utility\ApplicationUtils;
12 11
 use WebStream\Module\ClassLoader;
13
-use WebStream\Module\ServiceLocator;
14 12
 use WebStream\Exception\Extend\ValidateException;
15 13
 use WebStream\Exception\Extend\AnnotationException;
16 14
 use WebStream\Exception\Extend\InvalidRequestException;
Please login to merge, or discard this patch.
WebStream/Core/Application.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,6 @@
 block discarded – undo
6 6
 use WebStream\Exception\ApplicationException;
7 7
 use WebStream\Exception\SystemException;
8 8
 use WebStream\Exception\DelegateException;
9
-use WebStream\Module\ServiceLocator;
10 9
 
11 10
 /**
12 11
  * Applicationクラス
Please login to merge, or discard this patch.
WebStream/IO/Writer/OutputStreamWriter.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 
46 46
     /**
47 47
      * 出力ストリームに書き出す
48
-     * @param mixed $buf 出力データ
48
+     * @param string $buf 出力データ
49 49
      * @throws WebStream\Exception\Extend\IOException
50 50
      */
51 51
     public function write($buf)
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 namespace WebStream\IO\Writer;
3 3
 
4 4
 use WebStream\IO\OutputStream;
5
-use WebStream\Exception\Extend\InvalidArgumentException;
6 5
 
7 6
 /**
8 7
  * OutputStreamWriter
Please login to merge, or discard this patch.
WebStream/IO/Writer/SimpleFileWriter.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
     /**
51 51
      * ファイルに書き込む
52 52
      * ファイルが存在する場合、常に追記モード
53
-     * @param mixed $data 書き込みデータ
53
+     * @param string $data 書き込みデータ
54 54
      */
55 55
     public function write($data)
56 56
     {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 namespace WebStream\IO\Writer;
3 3
 
4 4
 use WebStream\IO\File;
5
-use WebStream\IO\FileOutputStream;
6 5
 use WebStream\Exception\Extend\IOException;
7 6
 
8 7
 /**
Please login to merge, or discard this patch.
WebStream/Log/LoggerConfigurationManager.php 2 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
     /**
33 33
      * Constructor
34
-     * @param mixed $config ログ設定
34
+     * @param string $config ログ設定
35 35
      * @throws LoggerException
36 36
      */
37 37
     public function __construct($config)
@@ -179,6 +179,7 @@  discard block
 block discarded – undo
179 179
     /**
180 180
      * ログローテートサイクルを時間に変換
181 181
      * @param string ローテートサイクル
182
+     * @param string $cycle
182 183
      * @return int ローテート時間
183 184
      * @throws LoggerException
184 185
      */
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,20 +41,20 @@  discard block
 block discarded – undo
41 41
         } else {
42 42
             $configMap = parse_ini_file($config);
43 43
             if ($configMap === null) {
44
-                throw new LoggerException("Log config file does not exist: " . $config);
44
+                throw new LoggerException("Log config file does not exist: ".$config);
45 45
             }
46 46
         }
47 47
 
48 48
         $this->logContainer = new Container(false);
49 49
         $this->ioContainer = new Container();
50 50
 
51
-        $this->ioContainer->file = function () use ($configMap) {
51
+        $this->ioContainer->file = function() use ($configMap) {
52 52
             if (!array_key_exists("path", $configMap)) {
53 53
                 throw new LoggerException("Log path must be defined.");
54 54
             }
55 55
             return new File($configMap["path"]);
56 56
         };
57
-        $this->ioContainer->fileWriter = function () use ($configMap) {
57
+        $this->ioContainer->fileWriter = function() use ($configMap) {
58 58
             return new SimpleFileWriter($configMap["path"]);
59 59
         };
60 60
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         }
113 113
 
114 114
         $this->logContainer->logPath = $file->getFilePath();
115
-        $this->logContainer->statusPath = preg_replace_callback('/(.*)\..+/', function ($matches) {
115
+        $this->logContainer->statusPath = preg_replace_callback('/(.*)\..+/', function($matches) {
116 116
             return "$matches[1].status";
117 117
         }, $this->logContainer->logPath);
118 118
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             $rotateSize = intval($this->configMap["rotate_size"]);
143 143
             // ローテートサイズが不正の場合(正の整数以外の値が設定された場合)
144 144
             if ($rotateSize <= 0) {
145
-                throw new LoggerException("Invalid log rotate size: " . $this->configMap["rotate_size"]);
145
+                throw new LoggerException("Invalid log rotate size: ".$this->configMap["rotate_size"]);
146 146
             }
147 147
             $this->logContainer->rotateSize = $rotateSize;
148 148
         }
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
             case 'year':
205 205
                 return $year_to_h;
206 206
             default:
207
-                throw new LoggerException("Invalid log rotate cycle: " . $cycle);
207
+                throw new LoggerException("Invalid log rotate cycle: ".$cycle);
208 208
         }
209 209
     }
210 210
 
Please login to merge, or discard this patch.
WebStream/Cache/Driver/Apcu.php 1 patch
Spacing   +15 added lines, -16 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
     public function __construct(Container $cacheContainer)
31 31
     {
32 32
         $this->cacheContainer = $cacheContainer;
33
-        $this->cachePrefix = $this->cacheContainer->cachePrefix . '.';
33
+        $this->cachePrefix = $this->cacheContainer->cachePrefix.'.';
34 34
         if (!empty($this->cacheContainer->classPrefix)) {
35
-            $this->cachePrefix .= $this->cacheContainer->classPrefix . '.';
35
+            $this->cachePrefix .= $this->cacheContainer->classPrefix.'.';
36 36
         }
37 37
     }
38 38
 
@@ -44,11 +44,10 @@  discard block
 block discarded – undo
44 44
         if (!$this->isAvailableCacheLibrary()) {
45 45
             return false;
46 46
         }
47
-        $key = $this->cachePrefix . $key;
47
+        $key = $this->cachePrefix.$key;
48 48
 
49
-        $result = $overwrite ? $this->cacheContainer->driver->delegate("apcu_store", [$key, $value, $ttl]) :
50
-            $this->cacheContainer->driver->delegate("apcu_add", [$key, $value, $ttl]);
51
-        $this->logger->info("Execute cache save: " . $key);
49
+        $result = $overwrite ? $this->cacheContainer->driver->delegate("apcu_store", [$key, $value, $ttl]) : $this->cacheContainer->driver->delegate("apcu_add", [$key, $value, $ttl]);
50
+        $this->logger->info("Execute cache save: ".$key);
52 51
 
53 52
         return $result;
54 53
     }
@@ -61,13 +60,13 @@  discard block
 block discarded – undo
61 60
         if (!$this->isAvailableCacheLibrary()) {
62 61
             return null;
63 62
         }
64
-        $key = $this->cachePrefix . $key;
63
+        $key = $this->cachePrefix.$key;
65 64
         $value = $this->cacheContainer->driver->delegate("apcu_fetch", [$key]);
66 65
 
67 66
         if ($value !== false) {
68
-            $this->logger->info("Execute cache read: " . $key);
67
+            $this->logger->info("Execute cache read: ".$key);
69 68
         } else {
70
-            $this->logger->warn("Failed to read cache: " . $key);
69
+            $this->logger->warn("Failed to read cache: ".$key);
71 70
             $value = null;
72 71
         }
73 72
 
@@ -82,13 +81,13 @@  discard block
 block discarded – undo
82 81
         if (!$this->isAvailableCacheLibrary()) {
83 82
             return false;
84 83
         }
85
-        $key = $this->cachePrefix . $key;
84
+        $key = $this->cachePrefix.$key;
86 85
 
87 86
         if ($this->cacheContainer->driver->delegate("apcu_delete", [$key])) {
88
-            $this->logger->info("Execute cache cleared: " . $key);
87
+            $this->logger->info("Execute cache cleared: ".$key);
89 88
             return true;
90 89
         } else {
91
-            $this->logger->warn("Failed to clear cache: " . $key);
90
+            $this->logger->warn("Failed to clear cache: ".$key);
92 91
             return false;
93 92
         }
94 93
     }
@@ -103,17 +102,17 @@  discard block
 block discarded – undo
103 102
         }
104 103
 
105 104
         if (class_exists('\APCUIterator')) {
106
-            $obj = new \APCUIterator('/^' . $this->cachePrefix . '/', APC_ITER_KEY);
105
+            $obj = new \APCUIterator('/^'.$this->cachePrefix.'/', APC_ITER_KEY);
107 106
             if ($this->cacheContainer->driver->delegate("apcu_delete", [$obj])) {
108
-                $this->logger->info("Execute all cache cleared: " . $this->cachePrefix . "*");
107
+                $this->logger->info("Execute all cache cleared: ".$this->cachePrefix."*");
109 108
                 return true;
110 109
             }
111 110
         } elseif ($this->cacheContainer->driver->delegate("apcu_clear_cache")) {
112
-            $this->logger->info("Execute all cache cleared: " . $this->cachePrefix . "*");
111
+            $this->logger->info("Execute all cache cleared: ".$this->cachePrefix."*");
113 112
             return true;
114 113
         }
115 114
 
116
-        $this->logger->warn("Failed to clear all cache: " . $this->cachePrefix . "*");
115
+        $this->logger->warn("Failed to clear all cache: ".$this->cachePrefix."*");
117 116
         return false;
118 117
     }
119 118
 
Please login to merge, or discard this patch.
WebStream/Module/ServiceLocator.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $container = new Container();
35 35
 
36 36
         // LoggerAdapter
37
-        $container->logger = function () {
37
+        $container->logger = function() {
38 38
             $instance = Logger::getInstance();
39 39
             $instance->setOutputter([
40 40
                 new FileOutputter($instance->getConfig()->logPath)
@@ -43,30 +43,30 @@  discard block
 block discarded – undo
43 43
             return new LoggerAdapter($instance);
44 44
         };
45 45
         // Request
46
-        $container->request = function () use (&$container) {
46
+        $container->request = function() use (&$container) {
47 47
             $request = new Request();
48 48
             $request->inject('logger', $container->logger);
49 49
 
50 50
             return $request->getContainer();
51 51
         };
52 52
         // Response
53
-        $container->response = function () use (&$container) {
53
+        $container->response = function() use (&$container) {
54 54
             $response = new Response();
55 55
             $response->inject('logger', $container->logger);
56 56
 
57 57
             return $response;
58 58
         };
59 59
         // Session
60
-        $container->session = function () use (&$container) {
60
+        $container->session = function() use (&$container) {
61 61
             $session = new Session();
62 62
             $session->inject('logger', $container->logger);
63 63
 
64 64
             return $session;
65 65
         };
66 66
         // Router
67
-        $container->router = function () use (&$container) {
67
+        $container->router = function() use (&$container) {
68 68
             // Router
69
-            $config = \Spyc::YAMLLoad($container->applicationInfo->applicationRoot . $container->applicationInfo->routeConfigPath);
69
+            $config = \Spyc::YAMLLoad($container->applicationInfo->applicationRoot.$container->applicationInfo->routeConfigPath);
70 70
             $router = new Router($config, $container->request);
71 71
             $router->inject('logger', $container->logger)
72 72
                    ->inject('applicationInfo', $container->applicationInfo);
@@ -75,20 +75,20 @@  discard block
 block discarded – undo
75 75
             return $router->getRoutingResult();
76 76
         };
77 77
         // CoreDelegator
78
-        $container->coreDelegator = function () use (&$container) {
78
+        $container->coreDelegator = function() use (&$container) {
79 79
             return new CoreDelegator($container);
80 80
         };
81 81
         // AnnotationDelegator
82
-        $container->annotationDelegator = function () use (&$container) {
82
+        $container->annotationDelegator = function() use (&$container) {
83 83
             return new AnnotationDelegator($container);
84 84
         };
85 85
         // twig
86
-        $container->twig = function () {
86
+        $container->twig = function() {
87 87
             Twig_Autoloader::register();
88 88
         };
89 89
         // Application Info
90 90
         $applicationRoot = $this->getApplicationRoot();
91
-        $container->applicationInfo = function () use ($applicationRoot) {
91
+        $container->applicationInfo = function() use ($applicationRoot) {
92 92
             $info = new Container();
93 93
             $info->applicationRoot = $applicationRoot;
94 94
             $info->applicationDir = "app";
Please login to merge, or discard this patch.
WebStream/Delegate/Router.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
             // 静的ファイルへのパスがルーティングルールに定義された場合
83 83
             // パス定義された時点で弾く
84 84
             if (preg_match('/\/(img|js|css|file)(?:$|\/)/', $path)) {
85
-                throw new RouterException("Include the prohibit routing path: " . $path);
85
+                throw new RouterException("Include the prohibit routing path: ".$path);
86 86
             }
87 87
             // 許可したルーティングパス定義に合っていなければ弾く
88 88
             if (!preg_match('/^\/{1}(?:$|:?[a-zA-Z]{1}[a-zA-Z0-9-_\/\.:]{0,}$)/', $path)) {
89
-                throw new RouterException("Invalid path defintion: " . $path);
89
+                throw new RouterException("Invalid path defintion: ".$path);
90 90
             }
91 91
             // ルールとURLがマッチした場合に動的にチェックを掛ける
92 92
             // パスがマッチしたときにアクション名をチェックし、その時点で弾く
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
                 // NG例:my__blog, my_blog_
97 97
                 if (!preg_match('/^(?:([a-z]{1}(?:_(?=[a-z])|[a-z0-9])+))#(?:([a-z]{1}(?:_(?=[a-z])|[a-z0-9])+))$/', $ca, $matches)) {
98 98
                     // ルーティング定義(Controller#Action)が正しくない場合
99
-                    throw new RouterException("Invalid controller#action definition: " . $ca);
99
+                    throw new RouterException("Invalid controller#action definition: ".$ca);
100 100
                 }
101 101
             }
102 102
         }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             if (($this->request->pathInfo !== $path) &&
130 130
                 count(explode('/', $path)) === count(explode('/', $this->request->pathInfo))) {
131 131
                 // プレースホルダと実URLをひもづける
132
-                $pathPattern = "/^\/" . implode("\/", $tokens) . "$/";
132
+                $pathPattern = "/^\/".implode("\/", $tokens)."$/";
133 133
                 if (preg_match($pathPattern, $this->request->pathInfo, $matches)) {
134 134
                     for ($j = 1; $j < count($matches); $j++) {
135 135
                         $key = $keyList[$j - 1];
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
                 $this->setController($matches[1]);
147 147
                 $this->setAction($matches[2]);
148 148
                 $this->routingContainer->params = $placeholderedParams;
149
-                $this->logger->info("Routed path: " . $matches[1] . "#" . $matches[2]);
149
+                $this->logger->info("Routed path: ".$matches[1]."#".$matches[2]);
150 150
 
151 151
                 // ルーティングルールがマッチした場合は抜ける
152 152
                 return true;
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      */
162 162
     private function resolveStaticFilePath()
163 163
     {
164
-        $staticFile = $this->applicationInfo->applicationRoot . "/app/views/" . $this->applicationInfo->publicDir . $this->request->pathInfo;
164
+        $staticFile = $this->applicationInfo->applicationRoot."/app/views/".$this->applicationInfo->publicDir.$this->request->pathInfo;
165 165
 
166 166
         if (is_file($staticFile)) {
167 167
             $this->routingContainer->staticFile = $staticFile;
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
             $less = new \lessc();
171 171
             $dirpath = dirname($staticFile);
172 172
             $filenameWitoutExt = pathinfo($staticFile, PATHINFO_FILENAME);
173
-            $lessFilepath = $dirpath . "/" . $filenameWitoutExt . ".less";
173
+            $lessFilepath = $dirpath."/".$filenameWitoutExt.".less";
174 174
             // lessファイルも見つからない場合はエラー
175 175
             if (!file_exists($lessFilepath)) {
176
-                $this->logger->error("The file of css has been specified, but not found even file of less:" . $lessFilepath);
176
+                $this->logger->error("The file of css has been specified, but not found even file of less:".$lessFilepath);
177 177
 
178 178
                 return;
179 179
             }
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
                 if (is_file($staticFile)) {
182 182
                     $this->routingContainer->staticFile = $staticFile;
183 183
                 } else {
184
-                    $this->logger->error("Failed to file create, cause parmission denied: " . $dirpath);
184
+                    $this->logger->error("Failed to file create, cause parmission denied: ".$dirpath);
185 185
                 }
186 186
             }
187 187
         }
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
     {
196 196
         if (isset($controller)) {
197 197
             $this->routingContainer->pageName = $this->snake2ucamel($controller);
198
-            $this->routingContainer->controller = $this->snake2ucamel($controller) . "Controller";
198
+            $this->routingContainer->controller = $this->snake2ucamel($controller)."Controller";
199 199
         }
200 200
     }
201 201
 
Please login to merge, or discard this patch.
WebStream/Template/Basic.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     public function __construct(Container $container)
59 59
     {
60 60
         $this->container = $container;
61
-        $this->session  = $container->session;
61
+        $this->session = $container->session;
62 62
         $this->timestamp = 0;
63 63
         $this->logger = $container->logger;
64 64
     }
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
         $params = ["model" => $params["model"], "helper" => $params["helper"]];
73 73
         $dirname = $this->camel2snake($this->container->router->pageName);
74 74
 
75
-        $templateFile = new File($this->container->applicationInfo->applicationRoot . "/app/views/" . $dirname . "/" . $this->container->filename);
76
-        $sharedFile = new File($this->container->applicationInfo->applicationRoot . "/app/views/" . $this->container->applicationInfo->sharedDir . "/" . $this->container->filename);
75
+        $templateFile = new File($this->container->applicationInfo->applicationRoot."/app/views/".$dirname."/".$this->container->filename);
76
+        $sharedFile = new File($this->container->applicationInfo->applicationRoot."/app/views/".$this->container->applicationInfo->sharedDir."/".$this->container->filename);
77 77
 
78 78
         $file = $templateFile->exists() ? $templateFile : ($sharedFile->exists() ? $sharedFile : null);
79 79
         if ($file === null) {
80
-            $errorMessage = "Invalid template file path: " . $templateFile->getFilePath() . " or " .  $sharedFile->getFilePath();
80
+            $errorMessage = "Invalid template file path: ".$templateFile->getFilePath()." or ".$sharedFile->getFilePath();
81 81
             throw new ResourceNotFoundException($errorMessage);
82 82
         }
83 83
 
@@ -93,12 +93,12 @@  discard block
 block discarded – undo
93 93
         $this->replaceTemplateMark($content, $mimeType);
94 94
 
95 95
         // テンプレートファイルをコンパイルし一時ファイルを作成
96
-        $tmpFile = new File($this->getTemporaryDirectory() . "/" . $this->getRandomstring(30));
96
+        $tmpFile = new File($this->getTemporaryDirectory()."/".$this->getRandomstring(30));
97 97
         $writer = new FileWriter($tmpFile);
98 98
         $writer->write($content);
99 99
         $writer->close();
100
-        $this->logger->debug("Write temporary template file: " . $tmpFile->getFilePath());
101
-        $this->logger->debug("Compiled template file size: " . $tmpFile->length());
100
+        $this->logger->debug("Write temporary template file: ".$tmpFile->getFilePath());
101
+        $this->logger->debug("Compiled template file size: ".$tmpFile->length());
102 102
 
103 103
         $params["__params__"] = $params;
104 104
         $params["__mimeType__"] = $mimeType;
@@ -128,18 +128,18 @@  discard block
 block discarded – undo
128 128
         // CSRFチェックが実行される前に非同期でリクエストがあった場合を考慮して
129 129
         // CSRFトークンは削除しない
130 130
         if (preg_match('/<form.*?>.*?<\/form>/is', $content)) {
131
-            $csrfToken = sha1($this->session->id() . microtime());
131
+            $csrfToken = sha1($this->session->id().microtime());
132 132
             $this->session->set($this->getCsrfTokenKey(), $csrfToken);
133 133
             $this->addToken($content, $csrfToken);
134 134
         }
135 135
 
136 136
         // テンプレートファイルをコンパイルし一時ファイルを作成
137
-        $tmpFile = new File($this->getTemporaryDirectory() . "/" . $this->getRandomstring(30));
137
+        $tmpFile = new File($this->getTemporaryDirectory()."/".$this->getRandomstring(30));
138 138
         $writer = new FileWriter($tmpFile);
139 139
         $writer->write($content);
140 140
         $writer->close();
141
-        $this->logger->debug("Write temporary template file: " . $tmpFile->getFilePath());
142
-        $this->logger->debug("Compiled template file size: " . $tmpFile->length());
141
+        $this->logger->debug("Write temporary template file: ".$tmpFile->getFilePath());
142
+        $this->logger->debug("Compiled template file size: ".$tmpFile->length());
143 143
 
144 144
         $params["__params__"] = $params;
145 145
         $params["__mimeType__"] = $mimeType;
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
      */
180 180
     public function cache($filename, $data, $expire)
181 181
     {
182
-        $cacheDir = $this->container->applicationInfo->applicationRoot . "/app/views/" . $this->container->applicationInfo->cacheDir;
182
+        $cacheDir = $this->container->applicationInfo->applicationRoot."/app/views/".$this->container->applicationInfo->cacheDir;
183 183
         $factory = new CacheDriverFactory();
184 184
         $config = new Container(false);
185 185
         $config->cacheDir = $cacheDir;
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
         $cache = $factory->create("WebStream\Cache\Driver\TemporaryFile", $config);
188 188
         $cache->inject('logger', $this->logger);
189 189
 
190
-        $file = new File($cacheDir . "/" . $filename . ".cache");
190
+        $file = new File($cacheDir."/".$filename.".cache");
191 191
         if (!$file->exists() || $this->timestamp > $file->lastModified()) {
192 192
             if ($cache->add($filename, $data, $expire)) {
193
-                $this->logger->debug("Write template cache file: " . $file->getFilePath());
193
+                $this->logger->debug("Write template cache file: ".$file->getFilePath());
194 194
             } else {
195
-                throw new IOException("File write failure: " . $file->getFilePath());
195
+                throw new IOException("File write failure: ".$file->getFilePath());
196 196
             }
197 197
         }
198 198
     }
@@ -219,29 +219,29 @@  discard block
 block discarded – undo
219 219
     {
220 220
         $originContentHash = md5($content);
221 221
 
222
-        $content = preg_replace_callback('/(%.{\$' . $this->getHelperVariableName() . '\->async\(.+?\)})/', function ($matches) {
222
+        $content = preg_replace_callback('/(%.{\$'.$this->getHelperVariableName().'\->async\(.+?\)})/', function($matches) {
223 223
             $asyncId = $this->getAsyncDomId();
224
-            $context = preg_replace_callback('/\$' . $this->getHelperVariableName() . '->async\((.+?)\)/', function ($matches2) use ($asyncId) {
225
-                return '$' . $this->getHelperVariableName() . '->async(' . $matches2[1] . ',\'' . $asyncId . '\')';
224
+            $context = preg_replace_callback('/\$'.$this->getHelperVariableName().'->async\((.+?)\)/', function($matches2) use ($asyncId) {
225
+                return '$'.$this->getHelperVariableName().'->async('.$matches2[1].',\''.$asyncId.'\')';
226 226
             }, $matches[1]);
227 227
 
228 228
             return "<div id='$asyncId'>$context</div>";
229 229
         }, $content);
230 230
 
231
-        $content = preg_replace('/' . self::TEMPLATE_MARK_PHP . '\{(.*?)\}/', '<?php echo $1; ?>', $content);
232
-        $content = preg_replace_callback('/' . self::TEMPLATE_MARK_TEMPLATE . '\{(.*?)\}/', function ($matches) {
231
+        $content = preg_replace('/'.self::TEMPLATE_MARK_PHP.'\{(.*?)\}/', '<?php echo $1; ?>', $content);
232
+        $content = preg_replace_callback('/'.self::TEMPLATE_MARK_TEMPLATE.'\{(.*?)\}/', function($matches) {
233 233
             if (substr($matches[1], 0, 1) === '$') {
234
-                return self::TEMPLATE_MARK_TEMPLATE . '{<?php echo ' . $matches[1] . ';?>}';
234
+                return self::TEMPLATE_MARK_TEMPLATE.'{<?php echo '.$matches[1].';?>}';
235 235
             } else {
236
-                return '<?php $this->draw(\'' . $matches[1] . '\', $__params__, $__mimeType__); ?>';
236
+                return '<?php $this->draw(\''.$matches[1].'\', $__params__, $__mimeType__); ?>';
237 237
             }
238 238
         }, $content);
239 239
 
240 240
         if ($mimeType === "xml") {
241
-            $content = preg_replace('/' . self::TEMPLATE_MARK_XML . '\{(.*?)\}/', '<?php echo safetyOutXML($1); ?>', $content);
241
+            $content = preg_replace('/'.self::TEMPLATE_MARK_XML.'\{(.*?)\}/', '<?php echo safetyOutXML($1); ?>', $content);
242 242
         } elseif ($mimeType === "html") {
243
-            $content = preg_replace('/' . self::TEMPLATE_MARK_HTML . '\{(.*?)\}/', '<?php echo safetyOut($1); ?>', $content);
244
-            $content = preg_replace('/' . self::TEMPLATE_MARK_JAVASCRIPT . '\{(.*?)\}/', '<?php echo safetyOutJavaScript($1); ?>', $content);
243
+            $content = preg_replace('/'.self::TEMPLATE_MARK_HTML.'\{(.*?)\}/', '<?php echo safetyOut($1); ?>', $content);
244
+            $content = preg_replace('/'.self::TEMPLATE_MARK_JAVASCRIPT.'\{(.*?)\}/', '<?php echo safetyOutJavaScript($1); ?>', $content);
245 245
         }
246 246
 
247 247
         $replacedContentHash = md5($content);
Please login to merge, or discard this patch.