@@ -64,7 +64,7 @@ |
||
64 | 64 | |
65 | 65 | /** |
66 | 66 | * SELECT |
67 | - * @return object 取得結果 |
|
67 | + * @return Result 取得結果 |
|
68 | 68 | */ |
69 | 69 | public function select() |
70 | 70 | { |
@@ -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)) { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * Constructor |
35 | 35 | * @param CoreInterface インスタンス |
36 | - * @param Container DIContainer |
|
36 | + * @param Container Container |
|
37 | 37 | */ |
38 | 38 | public function __construct(Container $container) |
39 | 39 | { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param object インスタンス |
55 | 55 | * @param string メソッド |
56 | 56 | * @param string アノテーションクラスパス |
57 | - * @return Container コンテナ |
|
57 | + * @return null|AnnotationContainer コンテナ |
|
58 | 58 | */ |
59 | 59 | public function read($instance, $method = null, $classpath = null) |
60 | 60 | { |
@@ -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 |
@@ -55,7 +55,8 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * CustomAnnotation結果を返却する |
57 | 57 | * @param string アノテーションID |
58 | - * @return Callable CustomAnnotation結果 |
|
58 | + * @param string $annotationId |
|
59 | + * @return \Closure CustomAnnotation結果 |
|
59 | 60 | */ |
60 | 61 | public function createAnnotationCallable($annotationId) |
61 | 62 | { |
@@ -94,7 +95,7 @@ discard block |
||
94 | 95 | |
95 | 96 | /** |
96 | 97 | * CustomAnnotation結果を返却する |
97 | - * @return Callable CustomAnnotation結果 |
|
98 | + * @return \Closure CustomAnnotation結果 |
|
98 | 99 | */ |
99 | 100 | public function createCustomAnnotationCallable() |
100 | 101 | { |
@@ -111,7 +112,7 @@ discard block |
||
111 | 112 | /** |
112 | 113 | * Header結果を返却する |
113 | 114 | * @param array<AnnotationContainer> アノテーションコンテナリスト |
114 | - * @return Callable Header結果 |
|
115 | + * @return \Closure Header結果 |
|
115 | 116 | */ |
116 | 117 | private function createHeader($containerList) |
117 | 118 | { |
@@ -129,7 +130,7 @@ discard block |
||
129 | 130 | /** |
130 | 131 | * Filter結果を返却する |
131 | 132 | * @param array<AnnotationContainer> アノテーションコンテナリスト |
132 | - * @return Callable Filter結果 |
|
133 | + * @return \Closure Filter結果 |
|
133 | 134 | */ |
134 | 135 | private function createFilter($containerList) |
135 | 136 | { |
@@ -213,7 +214,7 @@ discard block |
||
213 | 214 | /** |
214 | 215 | * Template結果を返却する |
215 | 216 | * @param array<AnnotationContainer> アノテーションコンテナリスト |
216 | - * @return Callable Template結果 |
|
217 | + * @return \Closure Template結果 |
|
217 | 218 | */ |
218 | 219 | private function createTemplate($containerList) |
219 | 220 | { |
@@ -229,7 +230,7 @@ discard block |
||
229 | 230 | /** |
230 | 231 | * ExceptionHandler結果を返却する |
231 | 232 | * @param array<AnnotationContainer> アノテーションコンテナリスト |
232 | - * @return Callable ExceptionHandler結果 |
|
233 | + * @return \Closure ExceptionHandler結果 |
|
233 | 234 | */ |
234 | 235 | private function createExceptionHandler($containerList) |
235 | 236 | { |
@@ -241,7 +242,7 @@ discard block |
||
241 | 242 | /** |
242 | 243 | * Database結果を返却する |
243 | 244 | * @param array<AnnotationContainer> アノテーションコンテナリスト |
244 | - * @return Callable Database結果 |
|
245 | + * @return \Closure Database結果 |
|
245 | 246 | */ |
246 | 247 | private function createDatabase($containerList) |
247 | 248 | { |
@@ -253,7 +254,7 @@ discard block |
||
253 | 254 | /** |
254 | 255 | * Query結果を返却する |
255 | 256 | * @param array<AnnotationContainer> アノテーションコンテナリスト |
256 | - * @return Callable Query結果 |
|
257 | + * @return \Closure Query結果 |
|
257 | 258 | */ |
258 | 259 | private function createQuery($containerList) |
259 | 260 | { |
@@ -265,7 +266,7 @@ discard block |
||
265 | 266 | /** |
266 | 267 | * Alias結果を返却する |
267 | 268 | * @param array<AnnotationContainer> アノテーションコンテナリスト |
268 | - * @return Callable Alias結果 |
|
269 | + * @return \Closure Alias結果 |
|
269 | 270 | */ |
270 | 271 | private function createAlias($containerList) |
271 | 272 | { |
@@ -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 | } |
@@ -39,7 +39,7 @@ |
||
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Constructor |
42 | - * @param Container 依存コンテナ |
|
42 | + * @param Container Container |
|
43 | 43 | */ |
44 | 44 | public function __construct(Container $container) |
45 | 45 | { |
@@ -72,66 +72,66 @@ discard block |
||
72 | 72 | $classLoader->inject('logger', $container->logger) |
73 | 73 | ->inject('applicationInfo', $container->applicationInfo); |
74 | 74 | $pageName = $this->getPageName(); |
75 | - $serviceClassName = $pageName . "Service"; |
|
76 | - $modelClassName = $pageName . "Model"; |
|
77 | - $helperClassName = $pageName . "Helper"; |
|
75 | + $serviceClassName = $pageName."Service"; |
|
76 | + $modelClassName = $pageName."Model"; |
|
77 | + $helperClassName = $pageName."Helper"; |
|
78 | 78 | $controllerNamespace = $this->getNamespace($container->router->controller); |
79 | 79 | $serviceNamespace = $this->getNamespace($serviceClassName); |
80 | 80 | $modelNamespace = $this->getNamespace($modelClassName); |
81 | 81 | $helperNamespace = $this->getNamespace($helperClassName); |
82 | 82 | |
83 | 83 | // Controller |
84 | - $this->coreContainer->controller = function () use ($container, $controllerNamespace) { |
|
85 | - $controllerClassPath = $controllerNamespace . "\\" . $container->router->controller; |
|
84 | + $this->coreContainer->controller = function() use ($container, $controllerNamespace) { |
|
85 | + $controllerClassPath = $controllerNamespace."\\".$container->router->controller; |
|
86 | 86 | if (!class_exists($controllerClassPath)) { |
87 | - throw new ClassNotFoundException("Undefined class path: " . $controllerClassPath); |
|
87 | + throw new ClassNotFoundException("Undefined class path: ".$controllerClassPath); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | return new $controllerClassPath($container); |
91 | 91 | }; |
92 | 92 | |
93 | 93 | // View |
94 | - $this->coreContainer->view = function () use ($container) { |
|
94 | + $this->coreContainer->view = function() use ($container) { |
|
95 | 95 | return new CoreView($container); |
96 | 96 | }; |
97 | 97 | |
98 | 98 | // Service |
99 | 99 | if ($serviceNamespace !== null) { |
100 | - $serviceClassPath = $serviceNamespace . "\\" . $serviceClassName; |
|
101 | - $this->coreContainer->service = function () use ($container, $classLoader, $serviceClassPath, $serviceClassName) { |
|
102 | - if ($classLoader->import($container->applicationInfo->applicationDir . "/services/" . $serviceClassName . ".php")) { |
|
100 | + $serviceClassPath = $serviceNamespace."\\".$serviceClassName; |
|
101 | + $this->coreContainer->service = function() use ($container, $classLoader, $serviceClassPath, $serviceClassName) { |
|
102 | + if ($classLoader->import($container->applicationInfo->applicationDir."/services/".$serviceClassName.".php")) { |
|
103 | 103 | return new $serviceClassPath($container); |
104 | 104 | } |
105 | 105 | }; |
106 | 106 | } else { |
107 | - $this->coreContainer->service = function () {}; |
|
107 | + $this->coreContainer->service = function() {}; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | // Model |
111 | 111 | if ($modelNamespace !== null) { |
112 | - $modelClassPath = $modelNamespace . "\\" . $modelClassName; |
|
113 | - $this->coreContainer->model = function () use ($container, $classLoader, $modelClassPath, $modelClassName) { |
|
114 | - if ($classLoader->import($container->applicationInfo->applicationDir . "/models/" . $modelClassName . ".php")) { |
|
112 | + $modelClassPath = $modelNamespace."\\".$modelClassName; |
|
113 | + $this->coreContainer->model = function() use ($container, $classLoader, $modelClassPath, $modelClassName) { |
|
114 | + if ($classLoader->import($container->applicationInfo->applicationDir."/models/".$modelClassName.".php")) { |
|
115 | 115 | return new $modelClassPath($container); |
116 | 116 | } |
117 | 117 | }; |
118 | 118 | } else { |
119 | 119 | $classpath = "\WebStream\Exception\Extend\ClassNotFoundException"; |
120 | - $message = $pageName . "Service and " . $pageName . "Model is not defined."; |
|
120 | + $message = $pageName."Service and ".$pageName."Model is not defined."; |
|
121 | 121 | $this->coreContainer->model = new CoreExceptionDelegator($classpath, $message); |
122 | 122 | } |
123 | 123 | |
124 | 124 | // Helper |
125 | 125 | if ($helperNamespace !== null) { |
126 | - $helperClassPath = $helperNamespace . "\\" . $helperClassName; |
|
127 | - $this->coreContainer->helper = function () use ($container, $classLoader, $helperClassPath, $helperClassName) { |
|
128 | - if ($classLoader->import($container->applicationInfo->applicationDir . "/helpers/" . $helperClassName . ".php")) { |
|
126 | + $helperClassPath = $helperNamespace."\\".$helperClassName; |
|
127 | + $this->coreContainer->helper = function() use ($container, $classLoader, $helperClassPath, $helperClassName) { |
|
128 | + if ($classLoader->import($container->applicationInfo->applicationDir."/helpers/".$helperClassName.".php")) { |
|
129 | 129 | return new $helperClassPath($container); |
130 | 130 | } |
131 | 131 | }; |
132 | 132 | } else { |
133 | 133 | $classpath = "\WebStream\Exception\Extend\ClassNotFoundException"; |
134 | - $message = $pageName . "Helper is not defined."; |
|
134 | + $message = $pageName."Helper is not defined."; |
|
135 | 135 | $this->coreContainer->helper = new CoreExceptionDelegator($classpath, $message); |
136 | 136 | } |
137 | 137 | } |
@@ -144,12 +144,12 @@ discard block |
||
144 | 144 | public function getNamespace($className) |
145 | 145 | { |
146 | 146 | $iterator = new \RecursiveIteratorIterator( |
147 | - new \RecursiveDirectoryIterator($this->container->applicationInfo->applicationRoot . "/app"), |
|
147 | + new \RecursiveDirectoryIterator($this->container->applicationInfo->applicationRoot."/app"), |
|
148 | 148 | \RecursiveIteratorIterator::LEAVES_ONLY, |
149 | 149 | \RecursiveIteratorIterator::CATCH_GET_CHILD // for Permission deny |
150 | 150 | ); |
151 | 151 | foreach ($iterator as $filepath => $fileObject) { |
152 | - if (strpos($filepath, $className . ".php") !== false) { |
|
152 | + if (strpos($filepath, $className.".php") !== false) { |
|
153 | 153 | return $this->getDefinedNamespace($filepath); |
154 | 154 | } |
155 | 155 | } |
@@ -120,7 +120,7 @@ |
||
120 | 120 | |
121 | 121 | /** |
122 | 122 | * Viewを起動する |
123 | - * @return CoreView Viewオブジェクト |
|
123 | + * @return CoreExecuteDelegator Viewオブジェクト |
|
124 | 124 | */ |
125 | 125 | public function runView() |
126 | 126 | { |
@@ -7,7 +7,6 @@ |
||
7 | 7 | use WebStream\Core\CoreHelper; |
8 | 8 | use WebStream\Module\Container; |
9 | 9 | use WebStream\Module\Utility\FileUtils; |
10 | -use WebStream\Exception\Extend\RouterException; |
|
11 | 10 | use WebStream\Exception\Extend\ResourceNotFoundException; |
12 | 11 | |
13 | 12 | /** |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | $this->response->start(); |
75 | 75 | |
76 | 76 | if ($this->router->controller !== null && $this->router->action !== null) { |
77 | - $iterator = $this->getFileSearchIterator($this->container->applicationInfo->applicationRoot . "/app/controllers"); |
|
77 | + $iterator = $this->getFileSearchIterator($this->container->applicationInfo->applicationRoot."/app/controllers"); |
|
78 | 78 | foreach ($iterator as $filepath => $fileObject) { |
79 | - if (strpos($filepath, $this->router->controller . ".php") !== false) { |
|
79 | + if (strpos($filepath, $this->router->controller.".php") !== false) { |
|
80 | 80 | include_once $filepath; |
81 | 81 | } |
82 | 82 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $controller->__callStaticFile($this->router->staticFile); |
88 | 88 | } else { |
89 | 89 | $this->response->clean(); |
90 | - $errorMsg = "Failed to resolve the routing: " . $this->request->requestUri; |
|
90 | + $errorMsg = "Failed to resolve the routing: ".$this->request->requestUri; |
|
91 | 91 | throw new ResourceNotFoundException($errorMsg); |
92 | 92 | } |
93 | 93 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | /** |
36 | 36 | * コンストラクタ |
37 | - * @param Request リクエストオブジェクト |
|
37 | + * @param Request Container |
|
38 | 38 | */ |
39 | 39 | public function __construct(array $rules, Container $request) |
40 | 40 | { |
@@ -190,6 +190,7 @@ discard block |
||
190 | 190 | /** |
191 | 191 | * コントローラを設定する |
192 | 192 | * @param string コントローラ文字列 |
193 | + * @param string $controller |
|
193 | 194 | */ |
194 | 195 | private function setController($controller) |
195 | 196 | { |
@@ -202,6 +203,7 @@ discard block |
||
202 | 203 | /** |
203 | 204 | * アクションを設定する |
204 | 205 | * @param string アクション文字列 |
206 | + * @param string $action |
|
205 | 207 | */ |
206 | 208 | private function setAction($action) |
207 | 209 | { |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | // 静的ファイルへのパスがルーティングルールに定義された場合 |
83 | 83 | // パス定義された時点で弾く |
84 | 84 | if (preg_match('/\/(img|js|css|file)(?:$|\/)/', $path)) { |
85 | - throw new RouterException("Include the prohibit routing path: " . $path); |
|
85 | + throw new RouterException("Include the prohibit routing path: ".$path); |
|
86 | 86 | } |
87 | 87 | // 許可したルーティングパス定義に合っていなければ弾く |
88 | 88 | if (!preg_match('/^\/{1}(?:$|:?[a-zA-Z]{1}[a-zA-Z0-9-_\/\.:]{0,}$)/', $path)) { |
89 | - throw new RouterException("Invalid path defintion: " . $path); |
|
89 | + throw new RouterException("Invalid path defintion: ".$path); |
|
90 | 90 | } |
91 | 91 | // ルールとURLがマッチした場合に動的にチェックを掛ける |
92 | 92 | // パスがマッチしたときにアクション名をチェックし、その時点で弾く |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | // NG例:my__blog, my_blog_ |
97 | 97 | if (!preg_match('/^(?:([a-z]{1}(?:_(?=[a-z])|[a-z0-9])+))#(?:([a-z]{1}(?:_(?=[a-z])|[a-z0-9])+))$/', $ca, $matches)) { |
98 | 98 | // ルーティング定義(Controller#Action)が正しくない場合 |
99 | - throw new RouterException("Invalid controller#action definition: " . $ca); |
|
99 | + throw new RouterException("Invalid controller#action definition: ".$ca); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | if (($this->request->pathInfo !== $path) && |
130 | 130 | count(explode('/', $path)) === count(explode('/', $this->request->pathInfo))) { |
131 | 131 | // プレースホルダと実URLをひもづける |
132 | - $pathPattern = "/^\/" . implode("\/", $tokens) . "$/"; |
|
132 | + $pathPattern = "/^\/".implode("\/", $tokens)."$/"; |
|
133 | 133 | if (preg_match($pathPattern, $this->request->pathInfo, $matches)) { |
134 | 134 | for ($j = 1; $j < count($matches); $j++) { |
135 | 135 | $key = $keyList[$j - 1]; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $this->setController($matches[1]); |
147 | 147 | $this->setAction($matches[2]); |
148 | 148 | $this->routingContainer->params = $placeholderedParams; |
149 | - $this->logger->info("Routed path: " . $matches[1] . "#" . $matches[2]); |
|
149 | + $this->logger->info("Routed path: ".$matches[1]."#".$matches[2]); |
|
150 | 150 | |
151 | 151 | // ルーティングルールがマッチした場合は抜ける |
152 | 152 | return true; |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | */ |
162 | 162 | private function resolveStaticFilePath() |
163 | 163 | { |
164 | - $staticFile = $this->applicationInfo->applicationRoot . "/app/views/" . $this->applicationInfo->publicDir . "/" . $this->request->pathInfo; |
|
164 | + $staticFile = $this->applicationInfo->applicationRoot."/app/views/".$this->applicationInfo->publicDir."/".$this->request->pathInfo; |
|
165 | 165 | |
166 | 166 | if (is_file($staticFile)) { |
167 | 167 | $this->routingContainer->staticFile = $staticFile; |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | $less = new \lessc(); |
171 | 171 | $dirpath = dirname($staticFile); |
172 | 172 | $filenameWitoutExt = pathinfo($staticFile, PATHINFO_FILENAME); |
173 | - $lessFilepath = $dirpath . "/" . $filenameWitoutExt . ".less"; |
|
173 | + $lessFilepath = $dirpath."/".$filenameWitoutExt.".less"; |
|
174 | 174 | // lessファイルも見つからない場合はエラー |
175 | 175 | if (!file_exists($lessFilepath)) { |
176 | - $this->logger->error("The file of css has been specified, but not found even file of less:" . $lessFilepath); |
|
176 | + $this->logger->error("The file of css has been specified, but not found even file of less:".$lessFilepath); |
|
177 | 177 | |
178 | 178 | return; |
179 | 179 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | if (is_file($staticFile)) { |
182 | 182 | $this->routingContainer->staticFile = $staticFile; |
183 | 183 | } else { |
184 | - $this->logger->error("Failed to file create, cause parmission denied: " . $dirpath); |
|
184 | + $this->logger->error("Failed to file create, cause parmission denied: ".$dirpath); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | { |
196 | 196 | if (isset($controller)) { |
197 | 197 | $this->routingContainer->pageName = $this->snake2ucamel($controller); |
198 | - $this->routingContainer->controller = $this->snake2ucamel($controller) . "Controller"; |
|
198 | + $this->routingContainer->controller = $this->snake2ucamel($controller)."Controller"; |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 |
@@ -17,6 +17,7 @@ |
||
17 | 17 | * オブジェクトを注入する |
18 | 18 | * @param string プロパティ名 |
19 | 19 | * @param mixed オブジェクト |
20 | + * @param string $name |
|
20 | 21 | * @return Injector |
21 | 22 | */ |
22 | 23 | public function inject($name, $object) |
@@ -26,7 +26,7 @@ |
||
26 | 26 | /** |
27 | 27 | * コンテナを作成する |
28 | 28 | * @param boolean テスト環境フラグ |
29 | - * @return object コンテナ |
|
29 | + * @return Container コンテナ |
|
30 | 30 | */ |
31 | 31 | public function getContainer() |
32 | 32 | { |
@@ -63,7 +63,7 @@ |
||
63 | 63 | $config = \Spyc::YAMLLoad($container->applicationInfo->applicationRoot . $container->applicationInfo->routeConfigPath); |
64 | 64 | $router = new Router($config, $container->request); |
65 | 65 | $router->inject('logger', $container->logger) |
66 | - ->inject('applicationInfo', $container->applicationInfo); |
|
66 | + ->inject('applicationInfo', $container->applicationInfo); |
|
67 | 67 | $router->resolve(); |
68 | 68 | |
69 | 69 | return $router->getRoutingResult(); |
@@ -33,34 +33,34 @@ discard block |
||
33 | 33 | $container = new Container(); |
34 | 34 | |
35 | 35 | // LoggerAdapter |
36 | - $container->logger = function () { |
|
36 | + $container->logger = function() { |
|
37 | 37 | return new LoggerAdapter(Logger::getInstance()); |
38 | 38 | }; |
39 | 39 | // Request |
40 | - $container->request = function () use (&$container) { |
|
40 | + $container->request = function() use (&$container) { |
|
41 | 41 | $request = new Request(); |
42 | 42 | $request->inject('logger', $container->logger); |
43 | 43 | |
44 | 44 | return $request->getContainer(); |
45 | 45 | }; |
46 | 46 | // Response |
47 | - $container->response = function () use (&$container) { |
|
47 | + $container->response = function() use (&$container) { |
|
48 | 48 | $response = new Response(); |
49 | 49 | $response->inject('logger', $container->logger); |
50 | 50 | |
51 | 51 | return $response; |
52 | 52 | }; |
53 | 53 | // Session |
54 | - $container->session = function () use (&$container) { |
|
54 | + $container->session = function() use (&$container) { |
|
55 | 55 | $session = new Session(); |
56 | 56 | $session->inject('logger', $container->logger); |
57 | 57 | |
58 | 58 | return $session; |
59 | 59 | }; |
60 | 60 | // Router |
61 | - $container->router = function () use (&$container) { |
|
61 | + $container->router = function() use (&$container) { |
|
62 | 62 | // Router |
63 | - $config = \Spyc::YAMLLoad($container->applicationInfo->applicationRoot . $container->applicationInfo->routeConfigPath); |
|
63 | + $config = \Spyc::YAMLLoad($container->applicationInfo->applicationRoot.$container->applicationInfo->routeConfigPath); |
|
64 | 64 | $router = new Router($config, $container->request); |
65 | 65 | $router->inject('logger', $container->logger) |
66 | 66 | ->inject('applicationInfo', $container->applicationInfo); |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | return $router->getRoutingResult(); |
70 | 70 | }; |
71 | 71 | // CoreDelegator |
72 | - $container->coreDelegator = function () use (&$container) { |
|
72 | + $container->coreDelegator = function() use (&$container) { |
|
73 | 73 | return new CoreDelegator($container); |
74 | 74 | }; |
75 | 75 | // AnnotationDelegator |
76 | - $container->annotationDelegator = function () use (&$container) { |
|
76 | + $container->annotationDelegator = function() use (&$container) { |
|
77 | 77 | return new AnnotationDelegator($container); |
78 | 78 | }; |
79 | 79 | // twig |
80 | - $container->twig = function () { |
|
80 | + $container->twig = function() { |
|
81 | 81 | Twig_Autoloader::register(); |
82 | 82 | }; |
83 | 83 | // Application Info |
@@ -13,6 +13,7 @@ |
||
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 | { |
@@ -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 | } |