Completed
Push — feature/0.7.0 ( 8e24e4...7b3202 )
by Ryuichi
03:10
created
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/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   +23 added lines, -23 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->size());
100
+        $this->logger->debug("Write temporary template file: ".$tmpFile->getFilePath());
101
+        $this->logger->debug("Compiled template file size: ".$tmpFile->size());
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->size());
141
+        $this->logger->debug("Write temporary template file: ".$tmpFile->getFilePath());
142
+        $this->logger->debug("Compiled template file size: ".$tmpFile->size());
143 143
 
144 144
         $params["__params__"] = $params;
145 145
         $params["__mimeType__"] = $mimeType;
@@ -179,15 +179,15 @@  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
         $cache = new Cache($cacheDir);
184 184
         $cache->inject('logger', $this->logger);
185
-        $file = new File($cacheDir . "/" . $filename . ".cache");
185
+        $file = new File($cacheDir."/".$filename.".cache");
186 186
         if (!$file->exists() || $this->timestamp > $file->lastModified()) {
187 187
             if ($cache->save($filename, $data, $expire)) {
188
-                $this->logger->debug("Write template cache file: " . $file->getFilePath());
188
+                $this->logger->debug("Write template cache file: ".$file->getFilePath());
189 189
             } else {
190
-                throw new IOException("File write failure: " . $file->getFilePath());
190
+                throw new IOException("File write failure: ".$file->getFilePath());
191 191
             }
192 192
         }
193 193
     }
@@ -214,23 +214,23 @@  discard block
 block discarded – undo
214 214
     {
215 215
         $originContentHash = md5($content);
216 216
 
217
-        $content = preg_replace_callback('/(%.{\$' . $this->getHelperVariableName() . '\->async\(.+?\)})/', function ($matches) {
217
+        $content = preg_replace_callback('/(%.{\$'.$this->getHelperVariableName().'\->async\(.+?\)})/', function($matches) {
218 218
             $asyncId = $this->getAsyncDomId();
219
-            $context = preg_replace_callback('/\$' . $this->getHelperVariableName() . '->async\((.+?)\)/', function ($matches2) use ($asyncId) {
220
-                return '$' . $this->getHelperVariableName() . '->async(' . $matches2[1] . ',\'' . $asyncId . '\')';
219
+            $context = preg_replace_callback('/\$'.$this->getHelperVariableName().'->async\((.+?)\)/', function($matches2) use ($asyncId) {
220
+                return '$'.$this->getHelperVariableName().'->async('.$matches2[1].',\''.$asyncId.'\')';
221 221
             }, $matches[1]);
222 222
 
223 223
             return "<div id='$asyncId'>$context</div>";
224 224
         }, $content);
225 225
 
226
-        $content = preg_replace('/' . self::TEMPLATE_MARK_PHP . '\{(.*?)\}/', '<?php echo $1; ?>', $content);
227
-        $content = preg_replace('/' . self::TEMPLATE_MARK_TEMPLATE . '\{(.*?)\}/', '<?php $this->draw("$1", $__params__, $__mimeType__); ?>', $content);
226
+        $content = preg_replace('/'.self::TEMPLATE_MARK_PHP.'\{(.*?)\}/', '<?php echo $1; ?>', $content);
227
+        $content = preg_replace('/'.self::TEMPLATE_MARK_TEMPLATE.'\{(.*?)\}/', '<?php $this->draw("$1", $__params__, $__mimeType__); ?>', $content);
228 228
 
229 229
         if ($mimeType === "xml") {
230
-            $content = preg_replace('/' . self::TEMPLATE_MARK_XML . '\{(.*?)\}/', '<?php echo safetyOutXML($1); ?>', $content);
230
+            $content = preg_replace('/'.self::TEMPLATE_MARK_XML.'\{(.*?)\}/', '<?php echo safetyOutXML($1); ?>', $content);
231 231
         } elseif ($mimeType === "html") {
232
-            $content = preg_replace('/' . self::TEMPLATE_MARK_HTML . '\{(.*?)\}/', '<?php echo safetyOut($1); ?>', $content);
233
-            $content = preg_replace('/' . self::TEMPLATE_MARK_JAVASCRIPT . '\{(.*?)\}/', '<?php echo safetyOutJavaScript($1); ?>', $content);
232
+            $content = preg_replace('/'.self::TEMPLATE_MARK_HTML.'\{(.*?)\}/', '<?php echo safetyOut($1); ?>', $content);
233
+            $content = preg_replace('/'.self::TEMPLATE_MARK_JAVASCRIPT.'\{(.*?)\}/', '<?php echo safetyOutJavaScript($1); ?>', $content);
234 234
         }
235 235
 
236 236
         $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.
WebStream/Core/CoreHelper.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,8 +96,8 @@
 block discarded – undo
96 96
     public function async($path, $id)
97 97
     {
98 98
         $safetyPath = str_replace('\\', '', $this->encodeJavaScript($path));
99
-        $url = "//" . $this->container->request->server("HTTP_HOST") . $this->container->request->getBaseURL() . $safetyPath;
99
+        $url = "//".$this->container->request->server("HTTP_HOST").$this->container->request->getBaseURL().$safetyPath;
100 100
 
101
-        return "<script type='text/javascript'>" . $this->asyncHelperCode($url, $id) . "</script>";
101
+        return "<script type='text/javascript'>".$this->asyncHelperCode($url, $id)."</script>";
102 102
     }
103 103
 }
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
     }
60 60
 
61 61
     /**
62
-    * {@inheritdoc}
62
+     * {@inheritdoc}
63 63
      */
64 64
     public function __customAnnotation(array $annotation)
65 65
     {
Please login to merge, or discard this patch.
WebStream/Core/CoreView.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -120,11 +120,11 @@
 block discarded – undo
120 120
     final public function __file($filepath)
121 121
     {
122 122
         $publicDir = $this->container->applicationInfo->publicDir;
123
-        if (preg_match('/\/views\/' . $publicDir . '\/img\/.+\.(?:jp(?:e|)g|png|bmp|(?:tif|gi)f)$/i', $filepath) ||
124
-            preg_match('/\/views\/' . $publicDir . '\/css\/.+\.css$/i', $filepath) ||
125
-            preg_match('/\/views\/' . $publicDir . '\/js\/.+\.js$/i', $filepath)) { // 画像,css,jsの場合
123
+        if (preg_match('/\/views\/'.$publicDir.'\/img\/.+\.(?:jp(?:e|)g|png|bmp|(?:tif|gi)f)$/i', $filepath) ||
124
+            preg_match('/\/views\/'.$publicDir.'\/css\/.+\.css$/i', $filepath) ||
125
+            preg_match('/\/views\/'.$publicDir.'\/js\/.+\.js$/i', $filepath)) { // 画像,css,jsの場合
126 126
             $this->display($filepath);
127
-        } elseif (preg_match('/\/views\/' . $publicDir . '\/file\/.+$/i', $filepath)) { // それ以外のファイル
127
+        } elseif (preg_match('/\/views\/'.$publicDir.'\/file\/.+$/i', $filepath)) { // それ以外のファイル
128 128
             $this->download($filepath);
129 129
         } else { // 全てのファイル
130 130
             $this->display($filepath);
Please login to merge, or discard this patch.
WebStream/Database/Driver/Sqlite.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,6 +31,6 @@
 block discarded – undo
31 31
         ]);
32 32
 
33 33
         $this->connection = DriverManager::getConnection($params, $config);
34
-        $this->logger->debug(get_class($this) . " connect.");
34
+        $this->logger->debug(get_class($this)." connect.");
35 35
     }
36 36
 }
Please login to merge, or discard this patch.
WebStream/Delegate/CoreExecuteDelegator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
 
181 181
         // テンプレートキャッシュチェック
182 182
         $pageName = $this->container->coreDelegator->getPageName();
183
-        $cacheFile = $applicationInfo->cachePrefix . $this->camel2snake($pageName) . "-" . $this->camel2snake($method);
184
-        $cache = new Cache($applicationInfo->applicationRoot . "/app/views/" . $applicationInfo->cacheDir);
183
+        $cacheFile = $applicationInfo->cachePrefix.$this->camel2snake($pageName)."-".$this->camel2snake($method);
184
+        $cache = new Cache($applicationInfo->applicationRoot."/app/views/".$applicationInfo->cacheDir);
185 185
         $cache->inject('logger', $this->logger);
186 186
         $data = $cache->get($cacheFile);
187 187
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
             ]);
249 249
 
250 250
             if ($template->cacheTime !== null) {
251
-                $cacheFile = $applicationInfo->cachePrefix . $this->camel2snake($pageName) . "-" . $this->camel2snake($method);
251
+                $cacheFile = $applicationInfo->cachePrefix.$this->camel2snake($pageName)."-".$this->camel2snake($method);
252 252
                 $view->templateCache($cacheFile, ob_get_contents(), $template->cacheTime);
253 253
             }
254 254
 
Please login to merge, or discard this patch.