Completed
Push — feature/0.7.0 ( 35ca3a...f911cc )
by Ryuichi
06:28
created
WebStream/Exception/ApplicationException.php 1 patch
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.
WebStream/Log/LoggerFormatter.php 1 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/Log/Logger.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
 
140 140
         // 設定ファイルが存在するかどうか
141 141
         if ($log === null) {
142
-            throw new LoggerException("Log config file does not exist: " . $configPath);
142
+            throw new LoggerException("Log config file does not exist: ".$configPath);
143 143
         }
144 144
 
145 145
         // ログレベル取得
146 146
         $logLevel = $this->toLogLevelValue($log["level"]);
147 147
         // 妥当なログレベルかどうか
148 148
         if ($logLevel === 0) {
149
-            throw new LoggerException("Invalid log level: " . $log["level"]);
149
+            throw new LoggerException("Invalid log level: ".$log["level"]);
150 150
         }
151 151
         $this->logLevel = $logLevel;
152 152
 
@@ -155,16 +155,16 @@  discard block
 block discarded – undo
155 155
         // 絶対パスでのチェック
156 156
         if (!realpath(dirname($path))) {
157 157
             $container = ServiceLocator::getInstance()->getContainer();
158
-            $path = $container->applicationInfo->applicationRoot . "/" . $log["path"];
158
+            $path = $container->applicationInfo->applicationRoot."/".$log["path"];
159 159
             // プロジェクトルートからの相対パスでのチェック
160 160
             if (!file_exists(dirname($path))) {
161
-                throw new LoggerException("Log directory does not exist: " . dirname($path));
161
+                throw new LoggerException("Log directory does not exist: ".dirname($path));
162 162
             }
163 163
         }
164 164
         $this->logPath = $path;
165 165
 
166 166
         // ステータスファイルパスを設定
167
-        $this->statusPath = preg_replace_callback('/(.*)\..+/', function ($matches) {
167
+        $this->statusPath = preg_replace_callback('/(.*)\..+/', function($matches) {
168 168
             return "$matches[1].status";
169 169
         }, $this->logPath);
170 170
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
             $rotateCycle = $this->cycle2value($log["rotate_cycle"]);
174 174
             // 妥当なローテートサイクルか
175 175
             if ($rotateCycle === 0) {
176
-                throw new LoggerException("Invalid log rotate cycle: " . $log["rotate_cycle"]);
176
+                throw new LoggerException("Invalid log rotate cycle: ".$log["rotate_cycle"]);
177 177
             }
178 178
             $this->rotateCycle = $rotateCycle;
179 179
         }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
             $rotateSize = intval($log["rotate_size"]);
184 184
             // ローテートサイズが不正の場合(正の整数以外の値が設定された場合)
185 185
             if ($rotateSize <= 0) {
186
-                throw new LoggerException("Invalid log rotate size: " . $log["rotate_size"]);
186
+                throw new LoggerException("Invalid log rotate size: ".$log["rotate_size"]);
187 187
             }
188 188
             $this->rotateSize = $rotateSize;
189 189
         }
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
         date_default_timezone_set('Asia/Tokyo');
263 263
         $msec = sprintf("%2d", floatval(microtime()) * 100);
264 264
 
265
-        return strftime("%Y-%m-%d %H:%M:%S") . "," . $msec;
265
+        return strftime("%Y-%m-%d %H:%M:%S").",".$msec;
266 266
     }
267 267
 
268 268
     /**
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
                 continue;
281 281
             }
282 282
             $msg .= "\n";
283
-            $msg .= "\t#" . trim($stacktraceLine);
283
+            $msg .= "\t#".trim($stacktraceLine);
284 284
         }
285 285
 
286 286
         return $msg;
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
         $content = fread($handle, $size);
342 342
         fclose($handle);
343 343
         if (!preg_match('/^\d{10}$/', $content)) {
344
-            throw new LoggerException("Invalid log state file contents: " . $content);
344
+            throw new LoggerException("Invalid log state file contents: ".$content);
345 345
         }
346 346
 
347 347
         return intval($content);
Please login to merge, or discard this patch.
WebStream/Core/CoreHelper.php 1 patch
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.
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/Core/CoreModel.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
                         $result = $this->manager->query($sql)->{$method}();
165 165
                     }
166 166
                 } else {
167
-                    throw new DatabaseException("Invalid SQL or bind parameters: " . $sql .", " . strval($bind));
167
+                    throw new DatabaseException("Invalid SQL or bind parameters: ".$sql.", ".strval($bind));
168 168
                 }
169 169
             } else {
170 170
                 $bind = null;
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
                     }
186 186
                 }
187 187
 
188
-                $queryKey = $this->classpath . "#" . $modelMethod;
188
+                $queryKey = $this->classpath."#".$modelMethod;
189 189
                 $queryId = $method;
190 190
 
191 191
                 $refClass = new \ReflectionClass($this);
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 
225 225
                 if ($entityClassPath !== null) {
226 226
                     if (!class_exists($entityClassPath)) {
227
-                        throw new DatabaseException("Entity classpath is not found: " . $entityClassPath);
227
+                        throw new DatabaseException("Entity classpath is not found: ".$entityClassPath);
228 228
                     }
229 229
 
230 230
                     switch ($method) {
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
                                     $result = $this->manager->query($sql)->select()->toEntity($entityClassPath);
237 237
                                 }
238 238
                             } else {
239
-                                $errorMessage = "Invalid SQL or bind parameters: " . $sql;
239
+                                $errorMessage = "Invalid SQL or bind parameters: ".$sql;
240 240
                                 if (is_array($bind)) {
241
-                                    $errorMessage .= ", " . strval($bind);
241
+                                    $errorMessage .= ", ".strval($bind);
242 242
                                 }
243 243
 
244 244
                                 throw new DatabaseException($errorMessage);
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
                             $result = $this->manager->query($sql)->{$method}();
263 263
                         }
264 264
                     } else {
265
-                        $errorMessage = "Invalid SQL or bind parameters: " . $sql;
265
+                        $errorMessage = "Invalid SQL or bind parameters: ".$sql;
266 266
                         if (is_array($bind)) {
267
-                            $errorMessage .= ", " . strval($bind);
267
+                            $errorMessage .= ", ".strval($bind);
268 268
                         }
269 269
 
270 270
                         throw new DatabaseException($errorMessage);
Please login to merge, or discard this patch.
WebStream/Http/Response.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
     public function setStatusCode($statusCode)
156 156
     {
157 157
         if (!is_string($statusCode) && !is_int($statusCode)) {
158
-            throw new ConnectionException("Invalid status code format: " . strval($statusCode));
158
+            throw new ConnectionException("Invalid status code format: ".strval($statusCode));
159 159
         }
160 160
 
161 161
         if (!array_key_exists($statusCode, $this->status)) {
162
-            throw new ConnectionException("Unknown status code: " . $statusCode);
162
+            throw new ConnectionException("Unknown status code: ".$statusCode);
163 163
         }
164 164
         $this->statusCode = $statusCode;
165 165
     }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     public function setContentDisposition($filename)
181 181
     {
182 182
         if (file_exists($filename)) {
183
-            $this->contentDisposition = 'attachement; filename="'. basename($filename) . '"';
183
+            $this->contentDisposition = 'attachement; filename="'.basename($filename).'"';
184 184
         }
185 185
     }
186 186
 
@@ -235,43 +235,43 @@  discard block
 block discarded – undo
235 235
     public function header()
236 236
     {
237 237
         // StatusCode
238
-        $headerMessage = 'HTTP/' . self::HTTP_VERSION . ' ' .
239
-                         $this->statusCode . ' ' . $this->status[$this->statusCode];
238
+        $headerMessage = 'HTTP/'.self::HTTP_VERSION.' '.
239
+                         $this->statusCode.' '.$this->status[$this->statusCode];
240 240
         header($headerMessage);
241 241
 
242 242
         // Redirect
243 243
         if (intval($this->statusCode) === 301) {
244
-            header('Location: ' . $this->location);
244
+            header('Location: '.$this->location);
245 245
         }
246 246
 
247 247
         // Content-Type
248
-        header('Content-Type: ' . $this->mimeType . '; charset=' . $this->charset);
248
+        header('Content-Type: '.$this->mimeType.'; charset='.$this->charset);
249 249
 
250 250
         // Content-Length
251 251
         if ($this->contentLength === null) {
252 252
             $this->contentLength = $this->bytelen($this->body);
253 253
         }
254
-        header('Content-Length: ' . $this->contentLength);
254
+        header('Content-Length: '.$this->contentLength);
255 255
 
256 256
         // Content-Disposition
257 257
         if ($this->contentDisposition !== null) {
258
-            header('Content-Disposition: ' . $this->contentDisposition);
258
+            header('Content-Disposition: '.$this->contentDisposition);
259 259
         }
260 260
 
261 261
         // Content-Transfer-Encoding
262 262
         if ($this->contentTransferEncoding !== null) {
263
-            header('Content-Transfer-Encoding: ' . $this->contentTransferEncoding);
263
+            header('Content-Transfer-Encoding: '.$this->contentTransferEncoding);
264 264
         }
265 265
 
266 266
         // Cache-Control
267
-        header('Cache-Control: ' . $this->cacheControl);
267
+        header('Cache-Control: '.$this->cacheControl);
268 268
 
269 269
         // Pragma
270
-        header('Pragma: ' . $this->pragma);
270
+        header('Pragma: '.$this->pragma);
271 271
 
272 272
         // Expires
273 273
         if ($this->expires !== null) {
274
-            header('Expires: ' . $this->expires);
274
+            header('Expires: '.$this->expires);
275 275
         }
276 276
 
277 277
         // X-Content-Type-Options
@@ -279,20 +279,20 @@  discard block
 block discarded – undo
279 279
 
280 280
         // Access-Control-Allow-Origin
281 281
         if (!empty($this->accessControlAllowOrigin)) {
282
-            header('Access-Control-Allow-Origin: ' . implode(',', $this->accessControlAllowOrigin));
282
+            header('Access-Control-Allow-Origin: '.implode(',', $this->accessControlAllowOrigin));
283 283
         }
284 284
 
285 285
         // X-Frame-Options
286 286
         if ($this->xframeOptions !== null) {
287
-            header('X-Frame-Options: ' . $this->xframeOptions);
287
+            header('X-Frame-Options: '.$this->xframeOptions);
288 288
         }
289 289
 
290 290
         // X-XSS-Protection
291 291
         if ($this->xxssProtection !== null) {
292
-            header('X-XSS-Protection: ' . $this->xxssProtection);
292
+            header('X-XSS-Protection: '.$this->xxssProtection);
293 293
         }
294 294
 
295
-        $this->logger->info("HTTP access occured: status code " . $this->statusCode);
295
+        $this->logger->info("HTTP access occured: status code ".$this->statusCode);
296 296
     }
297 297
 
298 298
     /**
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
         ob_clean(); // これまでの出力バッファをクリア
511 511
         $statusCode = array_key_exists($statusCode, $this->status) ? $statusCode : 500;
512 512
         $this->setStatusCode($statusCode);
513
-        $bodyMessage = $statusCode . ' ' . $this->status[$statusCode];
513
+        $bodyMessage = $statusCode.' '.$this->status[$statusCode];
514 514
         $this->setBody($this->bodyTemplate($bodyMessage));
515 515
         $this->send();
516 516
         exit;
Please login to merge, or discard this patch.
WebStream/Database/ConnectionManager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,14 +77,14 @@
 block discarded – undo
77 77
             $dsnHash = "";
78 78
             $databaseConfigContainer = new Container(false);
79 79
             foreach ($config as $key => $value) {
80
-                $dsnHash .= $key . $value;
80
+                $dsnHash .= $key.$value;
81 81
                 $databaseConfigContainer->set($key, $value);
82 82
             }
83 83
             $dsnHash = md5($dsnHash);
84 84
 
85 85
             $this->classpathMap[$container->filepath] = $dsnHash;
86 86
 
87
-            $this->connectionContainer->{$dsnHash} = function () use ($driverClassPath, $databaseConfigContainer, $logger) {
87
+            $this->connectionContainer->{$dsnHash} = function() use ($driverClassPath, $databaseConfigContainer, $logger) {
88 88
                 $driver = new $driverClassPath($databaseConfigContainer);
89 89
                 $driver->inject('logger', $logger);
90 90
 
Please login to merge, or discard this patch.
WebStream/Database/Query.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -120,9 +120,9 @@
 block discarded – undo
120 120
         try {
121 121
             $stmt = $this->driver->getStatement($this->sql);
122 122
             if ($stmt === false) {
123
-                throw new DatabaseException("Can't create statement: ". $this->sql);
123
+                throw new DatabaseException("Can't create statement: ".$this->sql);
124 124
             }
125
-            $this->logger->info("Executed SQL: " . $this->sql);
125
+            $this->logger->info("Executed SQL: ".$this->sql);
126 126
             foreach ($this->bind as $key => $value) {
127 127
                 $this->logger->info("Bind statement: $key => $value");
128 128
                 if (preg_match("/^[0-9]+$/", $value) && is_int($value)) {
Please login to merge, or discard this patch.