Completed
Push — feature/0.7.0 ( 35ca3a...f911cc )
by Ryuichi
06:28
created
WebStream/Log/LoggerFormatter.php 2 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,6 +30,7 @@  discard block
 block discarded – undo
30 30
     /**
31 31
      * コンストラクタ
32 32
      * @param string 設定ファイルパス
33
+     * @param string $configPath
33 34
      */
34 35
     public function __construct($configPath)
35 36
     {
@@ -41,7 +42,7 @@  discard block
 block discarded – undo
41 42
      * フォーマット済みメッセージを返却する
42 43
      * @param  string メッセージ
43 44
      * @param  string ログレベル
44
-     * @return フォーマット済みメッセージ
45
+     * @return string
45 46
      */
46 47
     public function getFormattedMessage($message, $logLevel)
47 48
     {
@@ -97,6 +98,7 @@  discard block
 block discarded – undo
97 98
      * アプリケーション名項目を埋め込む
98 99
      * @param  string メッセージ
99 100
      * @param  string アプリケーション名
101
+     * @param string $message
100 102
      * @return 埋め込み済みメッセージ
101 103
      */
102 104
     private function compileApplicationName($message, $applicationName)
@@ -113,6 +115,7 @@  discard block
 block discarded – undo
113 115
     /**
114 116
      * 日付項目を埋め込む
115 117
      * @param  string メッセージ
118
+     * @param string $message
116 119
      * @return 埋め込み済みメッセージ
117 120
      */
118 121
     private function compileDateTime($message)
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         // メッセージ
57 57
         $formattedMessage = preg_replace('/%m/', $message, $formattedMessage);
58 58
 
59
-        return $formattedMessage . "\n";
59
+        return $formattedMessage."\n";
60 60
     }
61 61
 
62 62
     /**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
         // 設定ファイルが存在するかどうか
71 71
         if ($log === null) {
72
-            throw new LoggerException("Log config file does not exist: " . $configPath);
72
+            throw new LoggerException("Log config file does not exist: ".$configPath);
73 73
         }
74 74
 
75 75
         // ログアプリケーション名
Please login to merge, or discard this patch.
WebStream/Module/Cache.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -22,6 +22,7 @@  discard block
 block discarded – undo
22 22
     /**
23 23
      * コンストラクタ
24 24
      * @param string キャッシュの保存ディレクトリパス
25
+     * @param string $savePath
25 26
      */
26 27
     public function __construct($savePath = null)
27 28
     {
@@ -34,6 +35,7 @@  discard block
 block discarded – undo
34 35
     /**
35 36
      * キャッシュを取得する
36 37
      * @param string キャッシュID
38
+     * @param string $id
37 39
      * @return string キャッシュデータ
38 40
      */
39 41
     public function get($id)
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     {
41 41
         $cache = $this->cache($id);
42 42
         if ($cache !== null) {
43
-            $path = $this->savePath . "/" . $id . '.cache';
43
+            $path = $this->savePath."/".$id.'.cache';
44 44
             $cachePath = realpath($path);
45 45
             $this->logger->info("Get cache: ${cachePath}");
46 46
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     private function cache($id)
76 76
     {
77
-        $path = $this->savePath . "/" . $id . '.cache';
77
+        $path = $this->savePath."/".$id.'.cache';
78 78
         $cachePath = realpath($path);
79 79
         if ($cachePath !== false && is_file($cachePath)) {
80 80
             $data = $this->decode(file_get_contents($cachePath));
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
         // キャッシュディレクトリが存在するか
116 116
         if (is_dir($this->savePath)) {
117
-            $cachePath = realpath($this->savePath) . '/' . basename($id) . '.cache';
117
+            $cachePath = realpath($this->savePath).'/'.basename($id).'.cache';
118 118
             // キャッシュファイルがない場合またはキャッシュファイルが存在するが、
119 119
             // 上書きする場合はキャッシュを新規作成する
120 120
             if (!is_file($cachePath) || (is_file($cachePath) && $overwrite === true)) {
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
 
127 127
                     return true;
128 128
                 } else { // ファイル書き込みに失敗した場合
129
-                    throw new IOException("Can't create cache: " . $cachePath);
129
+                    throw new IOException("Can't create cache: ".$cachePath);
130 130
                 }
131 131
             }
132 132
         } else {
133
-            $this->logger->error("Invalid cache directory: " . $this->savePath);
133
+            $this->logger->error("Invalid cache directory: ".$this->savePath);
134 134
         }
135 135
 
136 136
         return false;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      */
143 143
     public function delete($id)
144 144
     {
145
-        $cachePath = realpath($this->savePath . "/" . $id . '.cache');
145
+        $cachePath = realpath($this->savePath."/".$id.'.cache');
146 146
         if ($cachePath) {
147 147
             $this->logger->debug("Cache delete success: ${cachePath}");
148 148
 
Please login to merge, or discard this patch.
WebStream/Module/ClassLoader.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -27,6 +27,7 @@  discard block
 block discarded – undo
27 27
     /**
28 28
      * クラスをロードする
29 29
      * @param string|array クラス名
30
+     * @param string $className
30 31
      * @return array<string> ロード済みクラスリスト
31 32
      */
32 33
     public function load($className)
@@ -38,6 +39,7 @@  discard block
 block discarded – undo
38 39
      * ファイルをインポートする
39 40
      * @param string ファイルパス
40 41
      * @param callable フィルタリング無名関数 trueを返すとインポート
42
+     * @param string $filepath
41 43
      * @return boolean インポート結果
42 44
      */
43 45
     public function import($filepath, callable $filter = null)
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace WebStream\Module;
3 3
 
4
-require_once dirname(__FILE__) . '/Utility/FileUtils.php';
5
-require_once dirname(__FILE__) . '/../DI/Injector.php';
4
+require_once dirname(__FILE__).'/Utility/FileUtils.php';
5
+require_once dirname(__FILE__).'/../DI/Injector.php';
6 6
 
7 7
 use WebStream\Module\Utility\FileUtils;
8 8
 use WebStream\DI\Injector;
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
43 43
     public function import($filepath, callable $filter = null)
44 44
     {
45 45
         $rootDir = $this->applicationInfo->applicationRoot;
46
-        $includeFile = $rootDir . "/" . $filepath;
46
+        $includeFile = $rootDir."/".$filepath;
47 47
         if (is_file($includeFile)) {
48 48
             $ext = pathinfo($includeFile, PATHINFO_EXTENSION);
49 49
             if ($ext === 'php') {
50 50
                 if ($filter === null || (is_callable($filter) && $filter($includeFile) === true)) {
51 51
                     include_once $includeFile;
52
-                    $this->logger->debug($includeFile . " import success.");
52
+                    $this->logger->debug($includeFile." import success.");
53 53
                 }
54 54
             }
55 55
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     public function importAll($dirPath, callable $filter = null)
69 69
     {
70 70
         $rootDir = $this->applicationInfo->applicationRoot;
71
-        $includeDir = realpath($rootDir . "/" . $dirPath);
71
+        $includeDir = realpath($rootDir."/".$dirPath);
72 72
         if (is_dir($includeDir)) {
73 73
             $iterator = $this->getFileSearchIterator($includeDir);
74 74
             $isSuccess = true;
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
                     if ($ext === 'php') {
82 82
                         if ($filter === null || (is_callable($filter) && $filter($filepath) === true)) {
83 83
                             include_once $filepath;
84
-                            $this->logger->debug($filepath . " import success.");
84
+                            $this->logger->debug($filepath." import success.");
85 85
                         }
86 86
                     }
87 87
                 } else {
88
-                    $this->logger->warn($filepath . " import failure.");
88
+                    $this->logger->warn($filepath." import failure.");
89 89
                     $isSuccess = false;
90 90
                 }
91 91
             }
@@ -111,22 +111,22 @@  discard block
 block discarded – undo
111 111
         // まずcoreディレクトリを検索
112 112
         // coreディレクトリは名前空間とディレクトリパスが
113 113
         // 紐づいているのでそのまま連結して読ませる
114
-        $includeFile = $rootDir . "/core/" . $className . ".php";
114
+        $includeFile = $rootDir."/core/".$className.".php";
115 115
         if (is_file($includeFile)) {
116 116
             include_once $includeFile;
117
-            $this->logger->debug($includeFile . " load success. (search from " . $rootDir . "/core/)");
117
+            $this->logger->debug($includeFile." load success. (search from ".$rootDir."/core/)");
118 118
 
119 119
             return [$includeFile];
120 120
         }
121 121
 
122 122
         // さらに見つからなかったらappディレクトリを名前空間付きで全検索し、マッチするもの全てをincludeする
123
-        $iterator = $this->getFileSearchIterator($rootDir . "/app");
123
+        $iterator = $this->getFileSearchIterator($rootDir."/app");
124 124
         $includeList = [];
125 125
         foreach ($iterator as $filepath => $fileObject) {
126
-            if (strpos($filepath, $className . ".php") !== false) {
126
+            if (strpos($filepath, $className.".php") !== false) {
127 127
                 include_once $filepath;
128 128
                 $includeList[] = $filepath;
129
-                $this->logger->debug($filepath . " load success. (search from " . $rootDir . "/app/)");
129
+                $this->logger->debug($filepath." load success. (search from ".$rootDir."/app/)");
130 130
             }
131 131
         }
132 132
         if (!empty($includeList)) {
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
             $classNameWithoutNamespace = $matches[1];
140 140
             // この処理が走るケースはapp配下のクラスがディレクトリ構成と名前空間が一致していない
141 141
             // 場合以外ない(テスト用クラス除く)ので、app配下の検索を優先する
142
-            $iterator = $this->getFileSearchIterator($rootDir . "/app");
142
+            $iterator = $this->getFileSearchIterator($rootDir."/app");
143 143
             foreach ($iterator as $filepath => $fileObject) {
144
-                if (strpos($filepath, $classNameWithoutNamespace . ".php") !== false) {
144
+                if (strpos($filepath, $classNameWithoutNamespace.".php") !== false) {
145 145
                     include_once $filepath;
146 146
                     $includeList[] = $filepath;
147
-                    $this->logger->debug($filepath . " load success. (full search)");
147
+                    $this->logger->debug($filepath." load success. (full search)");
148 148
                 }
149 149
             }
150 150
             if (!empty($includeList)) {
@@ -152,12 +152,12 @@  discard block
 block discarded – undo
152 152
             }
153 153
 
154 154
             // ここに到達するのはテスト用クラスのみ
155
-            $iterator = $this->getFileSearchIterator($rootDir . "/core");
155
+            $iterator = $this->getFileSearchIterator($rootDir."/core");
156 156
             foreach ($iterator as $filepath => $fileObject) {
157
-                if (strpos($filepath, $classNameWithoutNamespace . ".php") !== false) {
157
+                if (strpos($filepath, $classNameWithoutNamespace.".php") !== false) {
158 158
                     include_once $filepath;
159 159
                     $includeList[] = $filepath;
160
-                    $this->logger->debug($filepath . " load success. (full search, use in test)");
160
+                    $this->logger->debug($filepath." load success. (full search, use in test)");
161 161
                 }
162 162
             }
163 163
             if (!empty($includeList)) {
Please login to merge, or discard this patch.
WebStream/Module/Container.php 1 patch
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -72,8 +72,6 @@
 block discarded – undo
72 72
 
73 73
     /**
74 74
      * キーの値を設定する
75
-     * @param  string $name      メソッド名
76
-     * @param  array  $arguments 引数リスト
77 75
      * @return void
78 76
      */
79 77
     public function set($key, $value)
Please login to merge, or discard this patch.
WebStream/Module/Functions.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,6 @@
 block discarded – undo
7 7
  */
8 8
 
9 9
 use WebStream\Module\Security;
10
-use WebStream\DI\ServiceLocator;
11 10
 use WebStream\Log\Logger;
12 11
 
13 12
 /**
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Functions
4
- * @author Ryuichi TANAKA.
5
- * @since 2013/09/04
6
- * @version 0.7
7
- */
3
+     * Functions
4
+     * @author Ryuichi TANAKA.
5
+     * @since 2013/09/04
6
+     * @version 0.7
7
+     */
8 8
 
9 9
 use WebStream\Module\Security;
10 10
 use WebStream\DI\ServiceLocator;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     {
19 19
         // ログ処理
20 20
         if ($error = error_get_last()) {
21
-            $errorMsg = $error['message'] . " " . $error['file'] . "(" . $error['line'] . ")";
21
+            $errorMsg = $error['message']." ".$error['file']."(".$error['line'].")";
22 22
             switch ($error['type']) {
23 23
                 case E_ERROR:
24 24
                 case E_CORE_ERROR:
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 if (!function_exists('safetyOutJSON')) {
93 93
     function safetyOutJSON($data)
94 94
     {
95
-        return json_encode($data, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT);
95
+        return json_encode($data, JSON_HEX_TAG|JSON_HEX_AMP|JSON_HEX_APOS|JSON_HEX_QUOT);
96 96
     }
97 97
 }
98 98
 
@@ -102,6 +102,6 @@  discard block
 block discarded – undo
102 102
 if (!function_exists('safetyOutJSONP')) {
103 103
     function safetyOutJSONP($data, $callback)
104 104
     {
105
-        return safetyOutJavaScript($callback) . "(" . safetyOutJSON($data) . ");";
105
+        return safetyOutJavaScript($callback)."(".safetyOutJSON($data).");";
106 106
     }
107 107
 }
Please login to merge, or discard this patch.
WebStream/Module/HttpClient.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -166,6 +166,7 @@  discard block
 block discarded – undo
166 166
      * @param array リクエストヘッダ
167 167
      * @param array<string> リクエストパラメータ
168 168
      * @param string 実行するRESTメソッド
169
+     * @param string $method
169 170
      * @return string レスポンス
170 171
      */
171 172
     private function http($url, $headers, $params, $method)
@@ -250,6 +251,8 @@  discard block
 block discarded – undo
250 251
      * @param array<string> オプション配列
251 252
      * @param string 配列キー
252 253
      * @param string or Integer デフォルト値
254
+     * @param string $key
255
+     * @param integer $default_value
253 256
      * @return mixed オプション配列の値
254 257
      */
255 258
     private function getOptionParameter($options, $key, $default_value = null)
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         $host = $this->proxy_host;
147 147
         $host = preg_replace('/^http(:\/\/.+)$/', 'tcp${1}', $host);
148 148
         $host = preg_replace('/^https(:\/\/.+)$/', 'ssl${1}', $host);
149
-        $request["proxy"] = $host . ":" . strval($this->proxy_port);
149
+        $request["proxy"] = $host.":".strval($this->proxy_port);
150 150
         $request["request_fulluri"] = true;
151 151
     }
152 152
 
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
      */
157 157
     private function basicAuth(&$headers)
158 158
     {
159
-        $headers[] = "Authorization: Basic " .
160
-            base64_encode($this->basic_auth_id . ":" . $this->basic_auth_password);
159
+        $headers[] = "Authorization: Basic ".
160
+            base64_encode($this->basic_auth_id.":".$this->basic_auth_password);
161 161
     }
162 162
 
163 163
     /**
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
             // GETの場合はstream_context_createでクエリを渡しても有効にならないため
176 176
             // URLにクエリストリングを付けることで対処
177 177
             if ($method === "GET") {
178
-                $url .= "?" . $params;
178
+                $url .= "?".$params;
179 179
             }
180 180
         }
181 181
         if (empty($headers) && ($method === "POST" || $method === "PUT")) {
182 182
             $contentLength = !is_string($params) ? 0 : strlen($params);
183 183
             $headers = [
184 184
                 "Content-Type: application/x-www-form-urlencoded",
185
-                "Content-Length: " . $contentLength
185
+                "Content-Length: ".$contentLength
186 186
             ];
187 187
         }
188 188
         $request = [
@@ -208,10 +208,10 @@  discard block
 block discarded – undo
208 208
             $hasHeader = @get_headers($url);
209 209
             if ($hasHeader === false) { // ヘッダを持たない場合、存在しないURL
210 210
                 $this->status_code = 404;
211
-                $this->logger->error("URL not found: " . $url);
211
+                $this->logger->error("URL not found: ".$url);
212 212
             } else { // ヘッダを持つ場合はタイムアウトが発生
213 213
                 $this->status_code = 408;
214
-                $this->logger->error("Request timeout: " . $url);
214
+                $this->logger->error("Request timeout: ".$url);
215 215
             }
216 216
 
217 217
             return null;
Please login to merge, or discard this patch.
WebStream/Module/Utility/ApplicationUtils.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -108,6 +108,7 @@
 block discarded – undo
108 108
      * CoreHelper#asyncで使用するコードを返却する
109 109
      * @param string URL
110 110
      * @param string CSSクラス名
111
+     * @param string $url
111 112
      * @return string コード
112 113
      */
113 114
     public function asyncHelperCode($url, $id)
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
         $isProjectRoot = false;
24 24
 
25 25
         while (!$isProjectRoot) {
26
-            if (file_exists($targetPath . DIRECTORY_SEPARATOR . $this->getProjectFileName())) {
26
+            if (file_exists($targetPath.DIRECTORY_SEPARATOR.$this->getProjectFileName())) {
27 27
                 $isProjectRoot = true;
28 28
             } else {
29 29
                 if (preg_match("/(.*)\//", $targetPath, $matches)) {
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
                 if (preg_match("/^namespace\s(.*);$/", $line, $matches)) {
57 57
                     $namespace = $matches[1];
58 58
                     if (substr($namespace, 0) !== '\\') {
59
-                        $namespace = '\\' . $namespace;
59
+                        $namespace = '\\'.$namespace;
60 60
                     }
61 61
 
62 62
                     return $namespace;
Please login to merge, or discard this patch.
WebStream/Template/Basic.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -195,6 +195,7 @@  discard block
 block discarded – undo
195 195
      * テンプレートを描画する
196 196
      * @param string テンプレートファイル
197 197
      * @param mixed 展開するパラメータ
198
+     * @param string $template
198 199
      */
199 200
     private function outputHTML($template, $params)
200 201
     {
@@ -207,6 +208,7 @@  discard block
 block discarded – undo
207 208
      * テンプレート記法を変換する
208 209
      * @param string 変換前出力内容
209 210
      * @param string mimeType
211
+     * @param string $content
210 212
      * @return bool 変換されたらtrue
211 213
      */
212 214
     private function replaceTemplateMark(&$content, $mimeType)
@@ -245,6 +247,7 @@  discard block
 block discarded – undo
245 247
     /**
246 248
      * すべてのformタグにCSRF対策トークンを追加する
247 249
      * @param string HTML文字列の参照
250
+     * @param string $csrfToken
248 251
      */
249 252
     private function addToken(&$content, $csrfToken)
250 253
     {
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -284,10 +284,10 @@
 block discarded – undo
284 284
         }
285 285
         // 実体参照化をもとに戻す。
286 286
         $map = array('&gt;' => '>',
287
-                     '&lt;' => '<',
288
-                     '%20'  => ' ',
289
-                     '%24'  => '$',
290
-                     '%5C'  => '\\');
287
+                        '&lt;' => '<',
288
+                        '%20'  => ' ',
289
+                        '%24'  => '$',
290
+                        '%5C'  => '\\');
291 291
 
292 292
         // HTMLタグを補完する
293 293
         $content = <<< HTML
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     public function __construct(Container $container)
56 56
     {
57 57
         $this->container = $container;
58
-        $this->session  = $container->session;
58
+        $this->session = $container->session;
59 59
         $this->timestamp = 0;
60 60
         $this->logger = $container->logger;
61 61
     }
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
         $params = ["model" => $params["model"], "helper" => $params["helper"]];
70 70
         $dirname = $this->camel2snake($this->container->router->pageName);
71 71
 
72
-        $filepath = $this->container->applicationInfo->applicationRoot . "/app/views/" . $dirname . "/" . $this->container->filename;
73
-        $sharedpath = $this->container->applicationInfo->applicationRoot . "/app/views/" . $this->container->applicationInfo->sharedDir . "/" . $this->container->filename;
72
+        $filepath = $this->container->applicationInfo->applicationRoot."/app/views/".$dirname."/".$this->container->filename;
73
+        $sharedpath = $this->container->applicationInfo->applicationRoot."/app/views/".$this->container->applicationInfo->sharedDir."/".$this->container->filename;
74 74
 
75 75
         $realpath = realpath($filepath) ?: realpath($sharedpath);
76 76
 
77 77
         if ($realpath === false) {
78
-            throw new ResourceNotFoundException("Invalid template file path: " . safetyOut($filepath));
78
+            throw new ResourceNotFoundException("Invalid template file path: ".safetyOut($filepath));
79 79
         }
80 80
 
81 81
         // テンプレートファイルの最新の変更日時を取得
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
         $this->replaceTemplateMark($content, $mimeType);
90 90
 
91 91
         // テンプレートファイルをコンパイルし一時ファイルを作成
92
-        $temp = $this->getTemporaryDirectory() . "/" . $this->getRandomstring(30);
92
+        $temp = $this->getTemporaryDirectory()."/".$this->getRandomstring(30);
93 93
         $fileSize = file_put_contents($temp, $content, LOCK_EX);
94 94
         if ($fileSize === false) {
95
-            throw new IOException("File write failure: " . $temp);
95
+            throw new IOException("File write failure: ".$temp);
96 96
         } else {
97
-            $this->logger->debug("Write temporary template file: " . $temp);
98
-            $this->logger->debug("Compiled template file size: " . $fileSize);
97
+            $this->logger->debug("Write temporary template file: ".$temp);
98
+            $this->logger->debug("Compiled template file size: ".$fileSize);
99 99
         }
100 100
 
101 101
         $params["__params__"] = $params;
@@ -126,19 +126,19 @@  discard block
 block discarded – undo
126 126
         // CSRFチェックが実行される前に非同期でリクエストがあった場合を考慮して
127 127
         // CSRFトークンは削除しない
128 128
         if (preg_match('/<form.*?>.*?<\/form>/is', $content)) {
129
-            $csrfToken = sha1($this->session->id() . microtime());
129
+            $csrfToken = sha1($this->session->id().microtime());
130 130
             $this->session->set($this->getCsrfTokenKey(), $csrfToken);
131 131
             $this->addToken($content, $csrfToken);
132 132
         }
133 133
 
134 134
         // テンプレートファイルをコンパイルし一時ファイルを作成
135
-        $temp = $this->getTemporaryDirectory() . "/" . $this->getRandomstring(30);
135
+        $temp = $this->getTemporaryDirectory()."/".$this->getRandomstring(30);
136 136
         $fileSize = file_put_contents($temp, $content, LOCK_EX);
137 137
         if ($fileSize === false) {
138
-            throw new IOException("File write failure: " . $temp);
138
+            throw new IOException("File write failure: ".$temp);
139 139
         } else {
140
-            $this->logger->debug("Write temporary template file: " . $temp);
141
-            $this->logger->debug("Compiled template file size: " . $fileSize);
140
+            $this->logger->debug("Write temporary template file: ".$temp);
141
+            $this->logger->debug("Compiled template file size: ".$fileSize);
142 142
         }
143 143
 
144 144
         $params["__params__"] = $params;
@@ -178,15 +178,15 @@  discard block
 block discarded – undo
178 178
      */
179 179
     public function cache($filename, $data, $expire)
180 180
     {
181
-        $cacheDir = $this->container->applicationInfo->applicationRoot . "/app/views/" . $this->container->applicationInfo->cacheDir;
181
+        $cacheDir = $this->container->applicationInfo->applicationRoot."/app/views/".$this->container->applicationInfo->cacheDir;
182 182
         $cache = new Cache($cacheDir);
183 183
         $cache->inject('logger', $this->logger);
184
-        $filepath = $cacheDir . "/" . $filename . ".cache";
184
+        $filepath = $cacheDir."/".$filename.".cache";
185 185
         if (!file_exists($filepath) || $this->timestamp > filemtime($filepath)) {
186 186
             if ($cache->save($filename, $data, $expire)) {
187
-                $this->logger->debug("Write template cache file: " . $filepath);
187
+                $this->logger->debug("Write template cache file: ".$filepath);
188 188
             } else {
189
-                throw new IOException("File write failure: " . $filepath);
189
+                throw new IOException("File write failure: ".$filepath);
190 190
             }
191 191
         }
192 192
     }
@@ -213,23 +213,23 @@  discard block
 block discarded – undo
213 213
     {
214 214
         $originContentHash = md5($content);
215 215
 
216
-        $content = preg_replace_callback('/(%.{\$' . $this->getHelperVariableName() . '\->async\(.+?\)})/', function ($matches) {
216
+        $content = preg_replace_callback('/(%.{\$'.$this->getHelperVariableName().'\->async\(.+?\)})/', function($matches) {
217 217
             $asyncId = $this->getAsyncDomId();
218
-            $context = preg_replace_callback('/\$' . $this->getHelperVariableName() . '->async\((.+?)\)/', function ($matches2) use ($asyncId) {
219
-                return '$' . $this->getHelperVariableName() . '->async(' . $matches2[1] . ',\'' . $asyncId . '\')';
218
+            $context = preg_replace_callback('/\$'.$this->getHelperVariableName().'->async\((.+?)\)/', function($matches2) use ($asyncId) {
219
+                return '$'.$this->getHelperVariableName().'->async('.$matches2[1].',\''.$asyncId.'\')';
220 220
             }, $matches[1]);
221 221
 
222 222
             return "<div id='$asyncId'>$context</div>";
223 223
         }, $content);
224 224
 
225
-        $content = preg_replace('/' . self::TEMPLATE_MARK_PHP . '\{(.*?)\}/', '<?php echo $1; ?>', $content);
226
-        $content = preg_replace('/' . self::TEMPLATE_MARK_TEMPLATE . '\{(.*?)\}/', '<?php $this->draw("$1", $__params__, $__mimeType__); ?>', $content);
225
+        $content = preg_replace('/'.self::TEMPLATE_MARK_PHP.'\{(.*?)\}/', '<?php echo $1; ?>', $content);
226
+        $content = preg_replace('/'.self::TEMPLATE_MARK_TEMPLATE.'\{(.*?)\}/', '<?php $this->draw("$1", $__params__, $__mimeType__); ?>', $content);
227 227
 
228 228
         if ($mimeType === "xml") {
229
-            $content = preg_replace('/' . self::TEMPLATE_MARK_XML . '\{(.*?)\}/', '<?php echo safetyOutXML($1); ?>', $content);
229
+            $content = preg_replace('/'.self::TEMPLATE_MARK_XML.'\{(.*?)\}/', '<?php echo safetyOutXML($1); ?>', $content);
230 230
         } elseif ($mimeType === "html") {
231
-            $content = preg_replace('/' . self::TEMPLATE_MARK_HTML . '\{(.*?)\}/', '<?php echo safetyOut($1); ?>', $content);
232
-            $content = preg_replace('/' . self::TEMPLATE_MARK_JAVASCRIPT . '\{(.*?)\}/', '<?php echo safetyOutJavaScript($1); ?>', $content);
231
+            $content = preg_replace('/'.self::TEMPLATE_MARK_HTML.'\{(.*?)\}/', '<?php echo safetyOut($1); ?>', $content);
232
+            $content = preg_replace('/'.self::TEMPLATE_MARK_JAVASCRIPT.'\{(.*?)\}/', '<?php echo safetyOutJavaScript($1); ?>', $content);
233 233
         }
234 234
 
235 235
         $replacedContentHash = md5($content);
Please login to merge, or discard this patch.
WebStream/Exception/ApplicationException.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
             $exception = $this;
27 27
         }
28 28
 
29
-        Logger::error(get_class($exception) . " is thrown: " . $exception->getFile() . "(" . $exception->getLine() . ")");
29
+        Logger::error(get_class($exception)." is thrown: ".$exception->getFile()."(".$exception->getLine().")");
30 30
         if (!empty($message)) {
31 31
             Logger::error($this->getMessage(), $this->getTraceAsString());
32 32
         }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -13,6 +13,7 @@
 block discarded – undo
13 13
 {
14 14
     /**
15 15
      * constructor
16
+     * @param \Exception $exception
16 17
      */
17 18
     public function __construct($message, $code = 500, $exception = null)
18 19
     {
Please login to merge, or discard this patch.