@@ -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); |
@@ -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 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * Constructor |
38 | 38 | * @param array<string> 注入後の返却情報 |
39 | - * @param Container 依存コンテナ |
|
39 | + * @param Container Container |
|
40 | 40 | */ |
41 | 41 | public function __construct(array $injectedAnnotation, Container $container) |
42 | 42 | { |
@@ -56,7 +56,8 @@ discard block |
||
56 | 56 | /** |
57 | 57 | * CustomAnnotation結果を返却する |
58 | 58 | * @param string アノテーションID |
59 | - * @return Callable CustomAnnotation結果 |
|
59 | + * @param string $annotationId |
|
60 | + * @return \Closure CustomAnnotation結果 |
|
60 | 61 | */ |
61 | 62 | public function createAnnotationCallable($annotationId) |
62 | 63 | { |
@@ -95,7 +96,7 @@ discard block |
||
95 | 96 | |
96 | 97 | /** |
97 | 98 | * CustomAnnotation結果を返却する |
98 | - * @return Callable CustomAnnotation結果 |
|
99 | + * @return \Closure CustomAnnotation結果 |
|
99 | 100 | */ |
100 | 101 | public function createCustomAnnotationCallable() |
101 | 102 | { |
@@ -112,7 +113,7 @@ discard block |
||
112 | 113 | /** |
113 | 114 | * Header結果を返却する |
114 | 115 | * @param array<AnnotationContainer> アノテーションコンテナリスト |
115 | - * @return Callable Header結果 |
|
116 | + * @return \Closure Header結果 |
|
116 | 117 | */ |
117 | 118 | private function createHeader($containerList) |
118 | 119 | { |
@@ -130,7 +131,7 @@ discard block |
||
130 | 131 | /** |
131 | 132 | * Filter結果を返却する |
132 | 133 | * @param array<AnnotationContainer> アノテーションコンテナリスト |
133 | - * @return Callable Filter結果 |
|
134 | + * @return \Closure Filter結果 |
|
134 | 135 | */ |
135 | 136 | private function createFilter($containerList) |
136 | 137 | { |
@@ -214,7 +215,7 @@ discard block |
||
214 | 215 | /** |
215 | 216 | * Template結果を返却する |
216 | 217 | * @param array<AnnotationContainer> アノテーションコンテナリスト |
217 | - * @return Callable Template結果 |
|
218 | + * @return \Closure Template結果 |
|
218 | 219 | */ |
219 | 220 | private function createTemplate($containerList) |
220 | 221 | { |
@@ -230,7 +231,7 @@ discard block |
||
230 | 231 | /** |
231 | 232 | * ExceptionHandler結果を返却する |
232 | 233 | * @param array<AnnotationContainer> アノテーションコンテナリスト |
233 | - * @return Callable ExceptionHandler結果 |
|
234 | + * @return \Closure ExceptionHandler結果 |
|
234 | 235 | */ |
235 | 236 | private function createExceptionHandler($containerList) |
236 | 237 | { |
@@ -242,7 +243,7 @@ discard block |
||
242 | 243 | /** |
243 | 244 | * Database結果を返却する |
244 | 245 | * @param array<AnnotationContainer> アノテーションコンテナリスト |
245 | - * @return Callable Database結果 |
|
246 | + * @return \Closure Database結果 |
|
246 | 247 | */ |
247 | 248 | private function createDatabase($containerList) |
248 | 249 | { |
@@ -254,7 +255,7 @@ discard block |
||
254 | 255 | /** |
255 | 256 | * Query結果を返却する |
256 | 257 | * @param array<AnnotationContainer> アノテーションコンテナリスト |
257 | - * @return Callable Query結果 |
|
258 | + * @return \Closure Query結果 |
|
258 | 259 | */ |
259 | 260 | private function createQuery($containerList) |
260 | 261 | { |
@@ -266,7 +267,7 @@ discard block |
||
266 | 267 | /** |
267 | 268 | * Alias結果を返却する |
268 | 269 | * @param array<AnnotationContainer> アノテーションコンテナリスト |
269 | - * @return Callable Alias結果 |
|
270 | + * @return \Closure Alias結果 |
|
270 | 271 | */ |
271 | 272 | private function createAlias($containerList) |
272 | 273 | { |
@@ -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; |
@@ -40,7 +40,7 @@ |
||
40 | 40 | if (class_exists($this->classpath)) { |
41 | 41 | throw new $this->classpath($this->message); |
42 | 42 | } else { |
43 | - throw new ClassNotFoundException($this->classpath . " is not found."); |
|
43 | + throw new ClassNotFoundException($this->classpath." is not found."); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | { |
42 | 42 | $applicationInfo = $this->container->applicationInfo; |
43 | 43 | $dirname = $this->camel2snake($this->container->router->pageName); |
44 | - $templateDir = $applicationInfo->applicationRoot . "/app/views/" . $dirname; |
|
45 | - $sharedDir = $applicationInfo->applicationRoot . "/app/views/" . $applicationInfo->sharedDir; |
|
44 | + $templateDir = $applicationInfo->applicationRoot."/app/views/".$dirname; |
|
45 | + $sharedDir = $applicationInfo->applicationRoot."/app/views/".$applicationInfo->sharedDir; |
|
46 | 46 | |
47 | 47 | if (is_dir($templateDir)) { |
48 | 48 | $this->loader->addPath($templateDir); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | $escaper = new \Twig_Extension_Escaper(true); |
55 | 55 | $twig = new \Twig_Environment($this->loader, [ |
56 | - 'cache' => $applicationInfo->applicationRoot . "/app/views/" . $applicationInfo->cacheDir, |
|
56 | + 'cache' => $applicationInfo->applicationRoot."/app/views/".$applicationInfo->cacheDir, |
|
57 | 57 | 'auto_reload' => true, |
58 | 58 | 'debug' => $this->container->debug |
59 | 59 | ]); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | // 制御文字削除 |
32 | 32 | $removes = []; |
33 | 33 | $removes[] = '/%0[0-8bcef]/'; // 00-08, 11, 12, 14, 15 |
34 | - $removes[] = '/%1[0-9a-f]/'; // 16-31 |
|
34 | + $removes[] = '/%1[0-9a-f]/'; // 16-31 |
|
35 | 35 | $removes[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
36 | 36 | |
37 | 37 | // $dataが数行にわたっている場合、一度で置換しきれないので繰り返す |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function camel2snake($str) |
76 | 76 | { |
77 | - $str = preg_replace_callback('/([A-Z])/', function ($matches) { |
|
78 | - return '_' . lcfirst($matches[1]); |
|
77 | + $str = preg_replace_callback('/([A-Z])/', function($matches) { |
|
78 | + return '_'.lcfirst($matches[1]); |
|
79 | 79 | }, $str); |
80 | 80 | |
81 | 81 | return preg_replace('/^_/', '', $str); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function snake2ucamel($str) |
90 | 90 | { |
91 | - $str = ucfirst(preg_replace_callback('/_([a-zA-Z])/', function ($matches) { |
|
91 | + $str = ucfirst(preg_replace_callback('/_([a-zA-Z])/', function($matches) { |
|
92 | 92 | return ucfirst($matches[1]); |
93 | 93 | }, $str)); |
94 | 94 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | public function parseConfig($filepath) |
21 | 21 | { |
22 | 22 | // 正規化した絶対パス |
23 | - $realpath = $this->getApplicationRoot() . DIRECTORY_SEPARATOR . $filepath; |
|
23 | + $realpath = $this->getApplicationRoot().DIRECTORY_SEPARATOR.$filepath; |
|
24 | 24 | |
25 | 25 | return file_exists($realpath) ? parse_ini_file($realpath) : null; |
26 | 26 | } |