@@ -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 | } |
@@ -108,6 +108,7 @@ |
||
108 | 108 | /** |
109 | 109 | * SERVERパラメータ取得 |
110 | 110 | * @param string パラメータキー |
111 | + * @param string $key |
|
111 | 112 | */ |
112 | 113 | private function server($key) |
113 | 114 | { |
@@ -67,6 +67,7 @@ discard block |
||
67 | 67 | /** |
68 | 68 | * Cache-Controlを設定 |
69 | 69 | * @param String Cache-Control |
70 | + * @param string $cacheControl |
|
70 | 71 | */ |
71 | 72 | public function setCacheControl($cacheControl) |
72 | 73 | { |
@@ -76,6 +77,7 @@ discard block |
||
76 | 77 | /** |
77 | 78 | * Pragmaを設定 |
78 | 79 | * @param String Pragma |
80 | + * @param string $pragma |
|
79 | 81 | */ |
80 | 82 | public function setPragma($pragma) |
81 | 83 | { |
@@ -86,6 +88,7 @@ discard block |
||
86 | 88 | * MimeTypeを設定 |
87 | 89 | * ファイルタイプにより指定 |
88 | 90 | * @param String ファイルタイプ |
91 | + * @param string $fileType |
|
89 | 92 | */ |
90 | 93 | public function setType($fileType) |
91 | 94 | { |
@@ -167,6 +170,7 @@ discard block |
||
167 | 170 | /** |
168 | 171 | * Content-Lengthを設定 |
169 | 172 | * @param Integer Content-Length |
173 | + * @param integer $contentLength |
|
170 | 174 | */ |
171 | 175 | public function setContentLength($contentLength) |
172 | 176 | { |
@@ -187,6 +191,7 @@ discard block |
||
187 | 191 | /** |
188 | 192 | * Content-Transfer-Encodingを設定 |
189 | 193 | * @param String エンコーディング方法 |
194 | + * @param string $contentTransferEncoding |
|
190 | 195 | */ |
191 | 196 | public function setContentTransferEncoding($contentTransferEncoding) |
192 | 197 | { |
@@ -196,6 +201,7 @@ discard block |
||
196 | 201 | /** |
197 | 202 | * Expiresを設定 |
198 | 203 | * @param Integer 有効期限 |
204 | + * @param integer $expires |
|
199 | 205 | */ |
200 | 206 | public function setExpires($expires) |
201 | 207 | { |
@@ -205,6 +211,7 @@ discard block |
||
205 | 211 | /** |
206 | 212 | * レスポンスボディを設定 |
207 | 213 | * @param String レスポンスボディ |
214 | + * @param string $body |
|
208 | 215 | */ |
209 | 216 | public function setBody($body) |
210 | 217 | { |
@@ -504,6 +511,7 @@ discard block |
||
504 | 511 | /** |
505 | 512 | * 指定したステータスコードのページに遷移 |
506 | 513 | * @param Integer ステータスコード |
514 | + * @param integer $statusCode |
|
507 | 515 | */ |
508 | 516 | public function move($statusCode) |
509 | 517 | { |
@@ -545,6 +553,7 @@ discard block |
||
545 | 553 | /** |
546 | 554 | * HTMLテンプレート |
547 | 555 | * @param String 表示内容 |
556 | + * @param string $content |
|
548 | 557 | * @return String HTML |
549 | 558 | */ |
550 | 559 | private function bodyTemplate($content) |
@@ -236,7 +236,7 @@ |
||
236 | 236 | { |
237 | 237 | // StatusCode |
238 | 238 | $headerMessage = 'HTTP/' . self::HTTP_VERSION . ' ' . |
239 | - $this->statusCode . ' ' . $this->status[$this->statusCode]; |
|
239 | + $this->statusCode . ' ' . $this->status[$this->statusCode]; |
|
240 | 240 | header($headerMessage); |
241 | 241 | |
242 | 242 | // Redirect |
@@ -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; |
@@ -49,6 +49,10 @@ |
||
49 | 49 | * @param string Cookieを有効にするドメイン |
50 | 50 | * @param boolean Secure属性を有効にする |
51 | 51 | * @param boolean HttpOnly属性を有効にする |
52 | + * @param string $path |
|
53 | + * @param string $domain |
|
54 | + * @param boolean $secure |
|
55 | + * @param boolean $httpOnly |
|
52 | 56 | */ |
53 | 57 | private function initialize($expire, $path, $domain, $secure, $httpOnly) |
54 | 58 | { |