@@ -26,7 +26,7 @@ |
||
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 | } |
@@ -120,11 +120,11 @@ |
||
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); |
@@ -155,11 +155,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -77,14 +77,14 @@ |
||
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 |
@@ -120,9 +120,9 @@ |
||
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)) { |
@@ -31,6 +31,6 @@ |
||
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 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | unset($injectedAnnotation[$annotationKey]); |
104 | 104 | } |
105 | 105 | |
106 | - return function () use ($injectedAnnotation) { |
|
106 | + return function() use ($injectedAnnotation) { |
|
107 | 107 | return $injectedAnnotation; |
108 | 108 | }; |
109 | 109 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | private function createHeader($containerList) |
117 | 117 | { |
118 | - return function () use ($containerList) { |
|
118 | + return function() use ($containerList) { |
|
119 | 119 | $headerContainer = new Container(); |
120 | 120 | $headerContainer->mimeType = "html"; |
121 | 121 | if ($containerList !== null) { |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | private function createFilter($containerList) |
135 | 135 | { |
136 | - return function () use ($containerList) { |
|
136 | + return function() use ($containerList) { |
|
137 | 137 | $filterListContainer = new Container(); |
138 | 138 | $filterListContainer->initialize = new AnnotationListContainer(); |
139 | 139 | $filterListContainer->before = new AnnotationListContainer(); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | // アクションメソッドの@Filter(type="skip")をチェックする |
146 | 146 | // 1メソッドに対して複数の@Filterが指定されてもエラーにはしない |
147 | 147 | foreach ($containerList as $filterAnnotation) { |
148 | - if ($filterAnnotation->classpath . "#" . $filterAnnotation->action === $filterAnnotation->method->class . "#" . $filterAnnotation->method->name) { |
|
148 | + if ($filterAnnotation->classpath."#".$filterAnnotation->action === $filterAnnotation->method->class."#".$filterAnnotation->method->name) { |
|
149 | 149 | if ($filterAnnotation->annotation->type === 'skip') { |
150 | 150 | $exceptMethods = $filterAnnotation->annotation->except; |
151 | 151 | if (!is_array($exceptMethods)) { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | private function createTemplate($containerList) |
219 | 219 | { |
220 | - return function () use ($containerList) { |
|
220 | + return function() use ($containerList) { |
|
221 | 221 | $templateContainer = new Container(false); |
222 | 222 | $templateContainer->engine = $containerList !== null ? $containerList[0]->engine : null; |
223 | 223 | $templateContainer->cacheTime = $containerList !== null ? $containerList[0]->cacheTime : null; |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | private function createExceptionHandler($containerList) |
235 | 235 | { |
236 | - return function () use ($containerList) { |
|
236 | + return function() use ($containerList) { |
|
237 | 237 | return $containerList === null ? [] : $containerList; |
238 | 238 | }; |
239 | 239 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | */ |
246 | 246 | private function createDatabase($containerList) |
247 | 247 | { |
248 | - return function () use ($containerList) { |
|
248 | + return function() use ($containerList) { |
|
249 | 249 | return $containerList; |
250 | 250 | }; |
251 | 251 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | */ |
258 | 258 | private function createQuery($containerList) |
259 | 259 | { |
260 | - return function () use ($containerList) { |
|
260 | + return function() use ($containerList) { |
|
261 | 261 | return $containerList; |
262 | 262 | }; |
263 | 263 | } |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | */ |
270 | 270 | private function createAlias($containerList) |
271 | 271 | { |
272 | - return function () use ($containerList) { |
|
273 | - return $containerList === null ? [] : $containerList;; |
|
272 | + return function() use ($containerList) { |
|
273 | + return $containerList === null ? [] : $containerList; ; |
|
274 | 274 | }; |
275 | 275 | } |
276 | 276 | } |
@@ -59,7 +59,7 @@ |
||
59 | 59 | public function read($instance, $method = null, $classpath = null) |
60 | 60 | { |
61 | 61 | if (!$instance instanceof IAnnotatable) { |
62 | - $this->logger->warn("Annotation is not available this class: " . get_class($instance)); |
|
62 | + $this->logger->warn("Annotation is not available this class: ".get_class($instance)); |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | // そうでなければ複数回メソッドが実行されるため |
85 | 85 | // ただし同一クラス内に限る(親クラスの同一名のメソッドは実行する) |
86 | 86 | // TODO ここはテストを追加する |
87 | - $classpath = $refMethod->class . "#" . $refMethod->name; |
|
87 | + $classpath = $refMethod->class."#".$refMethod->name; |
|
88 | 88 | if (!array_key_exists($classpath, $invokeMethods)) { |
89 | 89 | $invokeMethods[$classpath] = $refMethod; |
90 | 90 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | foreach ($invokeMethods as $classpath => $invokeMethod) { |
101 | 101 | $params = ["class" => get_class($this->instance), "method" => $this->method, "exception" => $originException]; |
102 | 102 | $invokeMethod->invokeArgs($this->instance, [$params]); |
103 | - $this->logger->debug("Execution of handling is success: " . $classpath); |
|
103 | + $this->logger->debug("Execution of handling is success: ".$classpath); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | throw $delegateException ?: $originException; |