@@ -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(); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $container = new Container(); |
| 35 | 35 | |
| 36 | 36 | // LoggerAdapter |
| 37 | - $container->logger = function () { |
|
| 37 | + $container->logger = function() { |
|
| 38 | 38 | $instance = Logger::getInstance(); |
| 39 | 39 | $instance->setOutputter([ |
| 40 | 40 | new FileOutputter($instance->getConfig()->logPath) |
@@ -43,30 +43,30 @@ discard block |
||
| 43 | 43 | return new LoggerAdapter($instance); |
| 44 | 44 | }; |
| 45 | 45 | // Request |
| 46 | - $container->request = function () use (&$container) { |
|
| 46 | + $container->request = function() use (&$container) { |
|
| 47 | 47 | $request = new Request(); |
| 48 | 48 | $request->inject('logger', $container->logger); |
| 49 | 49 | |
| 50 | 50 | return $request->getContainer(); |
| 51 | 51 | }; |
| 52 | 52 | // Response |
| 53 | - $container->response = function () use (&$container) { |
|
| 53 | + $container->response = function() use (&$container) { |
|
| 54 | 54 | $response = new Response(); |
| 55 | 55 | $response->inject('logger', $container->logger); |
| 56 | 56 | |
| 57 | 57 | return $response; |
| 58 | 58 | }; |
| 59 | 59 | // Session |
| 60 | - $container->session = function () use (&$container) { |
|
| 60 | + $container->session = function() use (&$container) { |
|
| 61 | 61 | $session = new Session(); |
| 62 | 62 | $session->inject('logger', $container->logger); |
| 63 | 63 | |
| 64 | 64 | return $session; |
| 65 | 65 | }; |
| 66 | 66 | // Router |
| 67 | - $container->router = function () use (&$container) { |
|
| 67 | + $container->router = function() use (&$container) { |
|
| 68 | 68 | // Router |
| 69 | - $config = \Spyc::YAMLLoad($container->applicationInfo->applicationRoot . $container->applicationInfo->routeConfigPath); |
|
| 69 | + $config = \Spyc::YAMLLoad($container->applicationInfo->applicationRoot.$container->applicationInfo->routeConfigPath); |
|
| 70 | 70 | $router = new Router($config, $container->request); |
| 71 | 71 | $router->inject('logger', $container->logger) |
| 72 | 72 | ->inject('applicationInfo', $container->applicationInfo); |
@@ -75,20 +75,20 @@ discard block |
||
| 75 | 75 | return $router->getRoutingResult(); |
| 76 | 76 | }; |
| 77 | 77 | // CoreDelegator |
| 78 | - $container->coreDelegator = function () use (&$container) { |
|
| 78 | + $container->coreDelegator = function() use (&$container) { |
|
| 79 | 79 | return new CoreDelegator($container); |
| 80 | 80 | }; |
| 81 | 81 | // AnnotationDelegator |
| 82 | - $container->annotationDelegator = function () use (&$container) { |
|
| 82 | + $container->annotationDelegator = function() use (&$container) { |
|
| 83 | 83 | return new AnnotationDelegator($container); |
| 84 | 84 | }; |
| 85 | 85 | // twig |
| 86 | - $container->twig = function () { |
|
| 86 | + $container->twig = function() { |
|
| 87 | 87 | Twig_Autoloader::register(); |
| 88 | 88 | }; |
| 89 | 89 | // Application Info |
| 90 | 90 | $applicationRoot = $this->getApplicationRoot(); |
| 91 | - $container->applicationInfo = function () use ($applicationRoot) { |
|
| 91 | + $container->applicationInfo = function() use ($applicationRoot) { |
|
| 92 | 92 | $info = new Container(); |
| 93 | 93 | $info->applicationRoot = $applicationRoot; |
| 94 | 94 | $info->applicationDir = "app"; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function add(string $content) |
| 52 | 52 | { |
| 53 | - $this->driver->add($this->key . $this->index++, $content); |
|
| 53 | + $this->driver->add($this->key.$this->index++, $content); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | $list = []; |
| 63 | 63 | for ($i = 0; $i < $this->index; $i++) { |
| 64 | - $list[] = $this->driver->get($this->key . $i); |
|
| 64 | + $list[] = $this->driver->get($this->key.$i); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | return $list; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function defaultLoggerFormatter() |
| 20 | 20 | { |
| 21 | - return '[%d{' . $this->defaultDateTimeFormatter() . '.%f}][%5L] %m'; |
|
| 21 | + return '[%d{'.$this->defaultDateTimeFormatter().'.%f}][%5L] %m'; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | continue; |
| 46 | 46 | } |
| 47 | 47 | $msg .= PHP_EOL; |
| 48 | - $msg .= "\t#" . trim($stacktraceLine); |
|
| 48 | + $msg .= "\t#".trim($stacktraceLine); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | return $msg; |
@@ -36,24 +36,24 @@ |
||
| 36 | 36 | $dirname = dirname($file); |
| 37 | 37 | $dir = new File($dirname); |
| 38 | 38 | if (!$dir->isWritable()) { |
| 39 | - throw new IOException("Cannot writable: " . $dirname); |
|
| 39 | + throw new IOException("Cannot writable: ".$dirname); |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | $this->file = new File($file); |
| 43 | 43 | $filepath = $this->file->getAbsoluteFilePath(); |
| 44 | 44 | } else { |
| 45 | - throw new InvalidArgumentException("Invalid argument type: " . $file); |
|
| 45 | + throw new InvalidArgumentException("Invalid argument type: ".$file); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $mode = $isAppend ? 'ab' : 'wb'; |
| 49 | 49 | $stream = fopen($filepath, $mode); |
| 50 | 50 | |
| 51 | 51 | if (!is_resource($stream) || $stream === false) { |
| 52 | - throw new IOException("Unable open " . $this->file->getAbsoluteFilePath()); |
|
| 52 | + throw new IOException("Unable open ".$this->file->getAbsoluteFilePath()); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if (!flock($stream, LOCK_EX | LOCK_NB)) { |
|
| 56 | - throw new IOException("Cannot lock file: " . $this->file->getAbsoluteFilePath()); |
|
| 55 | + if (!flock($stream, LOCK_EX|LOCK_NB)) { |
|
| 56 | + throw new IOException("Cannot lock file: ".$this->file->getAbsoluteFilePath()); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | parent::__construct($stream); |