@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $dirname = dirname($filepath); |
39 | 39 | $dir = new File($dirname); |
40 | 40 | if (!$dir->isWritable()) { |
41 | - throw new IOException("Cannot writable: " . $filepath); |
|
41 | + throw new IOException("Cannot writable: ".$filepath); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $this->filepath = $filepath; |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | if (!is_resource($stream) || $stream === false) { |
63 | - throw new IOException("Unable open " . $this->filepath); |
|
63 | + throw new IOException("Unable open ".$this->filepath); |
|
64 | 64 | } |
65 | 65 | |
66 | - if (!flock($stream, LOCK_EX | LOCK_NB)) { |
|
67 | - throw new IOException("Cannot lock file: " . $this->filepath); |
|
66 | + if (!flock($stream, LOCK_EX|LOCK_NB)) { |
|
67 | + throw new IOException("Cannot lock file: ".$this->filepath); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | if (fwrite($stream, $data) === false) { |
@@ -35,24 +35,24 @@ |
||
35 | 35 | $dirname = dirname($filepath); |
36 | 36 | $dir = new File($dirname); |
37 | 37 | if (!$dir->isWritable()) { |
38 | - throw new IOException("Cannot writable: " . $filepath); |
|
38 | + throw new IOException("Cannot writable: ".$filepath); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | $this->file = new File($file); |
42 | 42 | $filepath = $this->file->getFilePath(); |
43 | 43 | } else { |
44 | - throw new InvalidArgumentException("Invalid argument type: " . $file); |
|
44 | + throw new InvalidArgumentException("Invalid argument type: ".$file); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $mode = $isAppend ? 'ab' : 'wb'; |
48 | 48 | $stream = fopen($filepath, $mode); |
49 | 49 | |
50 | 50 | if (!is_resource($stream) || $stream === false) { |
51 | - throw new IOException("Unable open " . $this->file->getFilePath()); |
|
51 | + throw new IOException("Unable open ".$this->file->getFilePath()); |
|
52 | 52 | } |
53 | 53 | |
54 | - if (!flock($stream, LOCK_EX | LOCK_NB)) { |
|
55 | - throw new IOException("Cannot lock file: " . $this->file->getFilePath()); |
|
54 | + if (!flock($stream, LOCK_EX|LOCK_NB)) { |
|
55 | + throw new IOException("Cannot lock file: ".$this->file->getFilePath()); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | parent::__construct($stream); |
@@ -29,8 +29,8 @@ |
||
29 | 29 | public function __initialize(Container $container); |
30 | 30 | |
31 | 31 | /** |
32 | - * カスタムアノテーション情報を設定する |
|
33 | - * @param array<mixed> カスタムアノテーション情報 |
|
32 | + * カスタムアノテーション情報を設定する |
|
33 | + * @param array<mixed> カスタムアノテーション情報 |
|
34 | 34 | */ |
35 | 35 | public function __customAnnotation(array $annotation); |
36 | 36 | } |
@@ -59,7 +59,7 @@ |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
62 | - * {@inheritdoc} |
|
62 | + * {@inheritdoc} |
|
63 | 63 | */ |
64 | 64 | public function __customAnnotation(array $annotation) |
65 | 65 | { |
@@ -95,8 +95,8 @@ |
||
95 | 95 | public function async($path, $id) |
96 | 96 | { |
97 | 97 | $safetyPath = str_replace('\\', '', $this->encodeJavaScript($path)); |
98 | - $url = "//" . $this->container->request->httpHost . $this->container->request->baseUri . $safetyPath; |
|
98 | + $url = "//".$this->container->request->httpHost.$this->container->request->baseUri.$safetyPath; |
|
99 | 99 | |
100 | - return "<script type='text/javascript'>" . $this->asyncHelperCode($url, $id) . "</script>"; |
|
100 | + return "<script type='text/javascript'>".$this->asyncHelperCode($url, $id)."</script>"; |
|
101 | 101 | } |
102 | 102 | } |
@@ -39,7 +39,7 @@ discard block |
||
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 | { |
@@ -141,6 +141,7 @@ discard block |
||
141 | 141 | * 名前空間を返却する |
142 | 142 | * @param string アプリケーションルート |
143 | 143 | * @param string クラス名 |
144 | + * @param string $appRoot |
|
144 | 145 | * @return string 名前空間 |
145 | 146 | */ |
146 | 147 | public function getNamespace($appRoot, $className) |
@@ -72,67 +72,67 @@ 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"; |
|
78 | - $appRoot = $container->applicationInfo->applicationRoot . "/app"; |
|
75 | + $serviceClassName = $pageName."Service"; |
|
76 | + $modelClassName = $pageName."Model"; |
|
77 | + $helperClassName = $pageName."Helper"; |
|
78 | + $appRoot = $container->applicationInfo->applicationRoot."/app"; |
|
79 | 79 | $controllerNamespace = $this->getNamespace($appRoot, $container->router->controller); |
80 | 80 | $serviceNamespace = $this->getNamespace($appRoot, $serviceClassName); |
81 | 81 | $modelNamespace = $this->getNamespace($appRoot, $modelClassName); |
82 | 82 | $helperNamespace = $this->getNamespace($appRoot, $helperClassName); |
83 | 83 | |
84 | 84 | // Controller |
85 | - $this->coreContainer->controller = function () use ($container, $controllerNamespace) { |
|
86 | - $controllerClassPath = $controllerNamespace . "\\" . $container->router->controller; |
|
85 | + $this->coreContainer->controller = function() use ($container, $controllerNamespace) { |
|
86 | + $controllerClassPath = $controllerNamespace."\\".$container->router->controller; |
|
87 | 87 | if (!class_exists($controllerClassPath)) { |
88 | - throw new ClassNotFoundException("Undefined class path: " . $controllerClassPath); |
|
88 | + throw new ClassNotFoundException("Undefined class path: ".$controllerClassPath); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | return new $controllerClassPath($container); |
92 | 92 | }; |
93 | 93 | |
94 | 94 | // View |
95 | - $this->coreContainer->view = function () use ($container) { |
|
95 | + $this->coreContainer->view = function() use ($container) { |
|
96 | 96 | return new CoreView($container); |
97 | 97 | }; |
98 | 98 | |
99 | 99 | // Service |
100 | 100 | if ($serviceNamespace !== null) { |
101 | - $serviceClassPath = $serviceNamespace . "\\" . $serviceClassName; |
|
102 | - $this->coreContainer->service = function () use ($container, $classLoader, $serviceClassPath, $serviceClassName) { |
|
103 | - if ($classLoader->import($container->applicationInfo->applicationDir . "/services/" . $serviceClassName . ".php")) { |
|
101 | + $serviceClassPath = $serviceNamespace."\\".$serviceClassName; |
|
102 | + $this->coreContainer->service = function() use ($container, $classLoader, $serviceClassPath, $serviceClassName) { |
|
103 | + if ($classLoader->import($container->applicationInfo->applicationDir."/services/".$serviceClassName.".php")) { |
|
104 | 104 | return new $serviceClassPath($container); |
105 | 105 | } |
106 | 106 | }; |
107 | 107 | } else { |
108 | - $this->coreContainer->service = function () {}; |
|
108 | + $this->coreContainer->service = function() {}; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | // Model |
112 | 112 | if ($modelNamespace !== null) { |
113 | - $modelClassPath = $modelNamespace . "\\" . $modelClassName; |
|
114 | - $this->coreContainer->model = function () use ($container, $classLoader, $modelClassPath, $modelClassName) { |
|
115 | - if ($classLoader->import($container->applicationInfo->applicationDir . "/models/" . $modelClassName . ".php")) { |
|
113 | + $modelClassPath = $modelNamespace."\\".$modelClassName; |
|
114 | + $this->coreContainer->model = function() use ($container, $classLoader, $modelClassPath, $modelClassName) { |
|
115 | + if ($classLoader->import($container->applicationInfo->applicationDir."/models/".$modelClassName.".php")) { |
|
116 | 116 | return new $modelClassPath($container); |
117 | 117 | } |
118 | 118 | }; |
119 | 119 | } else { |
120 | 120 | $classpath = "\WebStream\Exception\Extend\ClassNotFoundException"; |
121 | - $message = $pageName . "Service and " . $pageName . "Model is not defined."; |
|
121 | + $message = $pageName."Service and ".$pageName."Model is not defined."; |
|
122 | 122 | $this->coreContainer->model = new CoreExceptionDelegator($classpath, $message); |
123 | 123 | } |
124 | 124 | |
125 | 125 | // Helper |
126 | 126 | if ($helperNamespace !== null) { |
127 | - $helperClassPath = $helperNamespace . "\\" . $helperClassName; |
|
128 | - $this->coreContainer->helper = function () use ($container, $classLoader, $helperClassPath, $helperClassName) { |
|
129 | - if ($classLoader->import($container->applicationInfo->applicationDir . "/helpers/" . $helperClassName . ".php")) { |
|
127 | + $helperClassPath = $helperNamespace."\\".$helperClassName; |
|
128 | + $this->coreContainer->helper = function() use ($container, $classLoader, $helperClassPath, $helperClassName) { |
|
129 | + if ($classLoader->import($container->applicationInfo->applicationDir."/helpers/".$helperClassName.".php")) { |
|
130 | 130 | return new $helperClassPath($container); |
131 | 131 | } |
132 | 132 | }; |
133 | 133 | } else { |
134 | 134 | $classpath = "\WebStream\Exception\Extend\ClassNotFoundException"; |
135 | - $message = $pageName . "Helper is not defined."; |
|
135 | + $message = $pageName."Helper is not defined."; |
|
136 | 136 | $this->coreContainer->helper = new CoreExceptionDelegator($classpath, $message); |
137 | 137 | } |
138 | 138 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | \RecursiveIteratorIterator::CATCH_GET_CHILD // for Permission deny |
153 | 153 | ); |
154 | 154 | foreach ($iterator as $filepath => $fileObject) { |
155 | - if (strpos($filepath, $className . ".php") !== false) { |
|
155 | + if (strpos($filepath, $className.".php") !== false) { |
|
156 | 156 | return $this->getDefinedNamespace($filepath); |
157 | 157 | } |
158 | 158 | } |
@@ -90,10 +90,10 @@ |
||
90 | 90 | |
91 | 91 | $controller = new $controllerClassPath(); |
92 | 92 | $controller->inject('request', $container->request) |
93 | - ->inject('response', $container->response) |
|
94 | - ->inject('session', $container->session) |
|
95 | - ->inject('coreDelegator', $container->coreDelegator) |
|
96 | - ->inject('logger', $container->logger); |
|
93 | + ->inject('response', $container->response) |
|
94 | + ->inject('session', $container->session) |
|
95 | + ->inject('coreDelegator', $container->coreDelegator) |
|
96 | + ->inject('logger', $container->logger); |
|
97 | 97 | |
98 | 98 | $container->logger->debug("Controller start."); |
99 | 99 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | if (!function_exists('safetyOutJSON')) { |
56 | 56 | function safetyOutJSON($data) |
57 | 57 | { |
58 | - return json_encode($data, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); |
|
58 | + return json_encode($data, JSON_HEX_TAG|JSON_HEX_AMP|JSON_HEX_APOS|JSON_HEX_QUOT); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
@@ -65,6 +65,6 @@ discard block |
||
65 | 65 | if (!function_exists('safetyOutJSONP')) { |
66 | 66 | function safetyOutJSONP($data, $callback) |
67 | 67 | { |
68 | - return safetyOutJavaScript($callback) . "(" . safetyOutJSON($data) . ");"; |
|
68 | + return safetyOutJavaScript($callback)."(".safetyOutJSON($data).");"; |
|
69 | 69 | } |
70 | 70 | } |
@@ -98,7 +98,7 @@ |
||
98 | 98 | if (array_key_exists($col, $propertyMap)) { |
99 | 99 | $propertyMap[$col]->setValue($instance, $value); |
100 | 100 | } else { |
101 | - $this->logger->error("Column '$col' is failed mapping in " . $this->classpath); |
|
101 | + $this->logger->error("Column '$col' is failed mapping in ".$this->classpath); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | } |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace WebStream\Cache\Driver; |
3 | 3 | |
4 | -use WebStream\DI\Injector; |
|
5 | 4 | use WebStream\Module\Container; |
6 | 5 | |
7 | 6 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | public function __construct(Container $cacheContainer) |
31 | 31 | { |
32 | 32 | $this->cacheContainer = $cacheContainer; |
33 | - $this->cachePrefix = $this->cacheContainer->cachePrefix . '.' . $this->cacheContainer->classPrefix . '.'; |
|
33 | + $this->cachePrefix = $this->cacheContainer->cachePrefix.'.'.$this->cacheContainer->classPrefix.'.'; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -41,11 +41,10 @@ discard block |
||
41 | 41 | if (!$this->isAvailableCacheLibrary()) { |
42 | 42 | return false; |
43 | 43 | } |
44 | - $key = $this->cachePrefix . $key; |
|
44 | + $key = $this->cachePrefix.$key; |
|
45 | 45 | |
46 | - $result = $overwrite ? $this->cacheContainer->driver->delegate("apcu_store", [$key, $value, $ttl]) : |
|
47 | - $this->cacheContainer->driver->delegate("apcu_add", [$key, $value, $ttl]); |
|
48 | - $this->logger->info("Execute cache save: " . $key); |
|
46 | + $result = $overwrite ? $this->cacheContainer->driver->delegate("apcu_store", [$key, $value, $ttl]) : $this->cacheContainer->driver->delegate("apcu_add", [$key, $value, $ttl]); |
|
47 | + $this->logger->info("Execute cache save: ".$key); |
|
49 | 48 | |
50 | 49 | return $result; |
51 | 50 | } |
@@ -58,13 +57,13 @@ discard block |
||
58 | 57 | if (!$this->isAvailableCacheLibrary()) { |
59 | 58 | return null; |
60 | 59 | } |
61 | - $key = $this->cachePrefix . $key; |
|
60 | + $key = $this->cachePrefix.$key; |
|
62 | 61 | $value = $this->cacheContainer->driver->delegate("apcu_fetch", [$key]); |
63 | 62 | |
64 | 63 | if ($value !== false) { |
65 | - $this->logger->info("Execute cache read: " . $key); |
|
64 | + $this->logger->info("Execute cache read: ".$key); |
|
66 | 65 | } else { |
67 | - $this->logger->warn("Failed to read cache: " . $key); |
|
66 | + $this->logger->warn("Failed to read cache: ".$key); |
|
68 | 67 | $value = null; |
69 | 68 | } |
70 | 69 | |
@@ -79,13 +78,13 @@ discard block |
||
79 | 78 | if (!$this->isAvailableCacheLibrary()) { |
80 | 79 | return false; |
81 | 80 | } |
82 | - $key = $this->cachePrefix . $key; |
|
81 | + $key = $this->cachePrefix.$key; |
|
83 | 82 | |
84 | 83 | if ($this->cacheContainer->driver->delegate("apcu_delete", [$key])) { |
85 | - $this->logger->info("Execute cache cleared: " . $key); |
|
84 | + $this->logger->info("Execute cache cleared: ".$key); |
|
86 | 85 | return true; |
87 | 86 | } else { |
88 | - $this->logger->warn("Failed to clear cache: " . $key); |
|
87 | + $this->logger->warn("Failed to clear cache: ".$key); |
|
89 | 88 | return false; |
90 | 89 | } |
91 | 90 | } |
@@ -100,17 +99,17 @@ discard block |
||
100 | 99 | } |
101 | 100 | |
102 | 101 | if (class_exists('\APCUIterator')) { |
103 | - $obj = new \APCUIterator('/^' . $this->cachePrefix . '/', APC_ITER_KEY); |
|
102 | + $obj = new \APCUIterator('/^'.$this->cachePrefix.'/', APC_ITER_KEY); |
|
104 | 103 | if ($this->cacheContainer->driver->delegate("apcu_delete", [$obj])) { |
105 | - $this->logger->info("Execute all cache cleared: " . $this->cachePrefix . "*"); |
|
104 | + $this->logger->info("Execute all cache cleared: ".$this->cachePrefix."*"); |
|
106 | 105 | return true; |
107 | 106 | } |
108 | 107 | } elseif ($this->cacheContainer->driver->delegate("apcu_clear_cache")) { |
109 | - $this->logger->info("Execute all cache cleared: " . $this->cachePrefix . "*"); |
|
108 | + $this->logger->info("Execute all cache cleared: ".$this->cachePrefix."*"); |
|
110 | 109 | return true; |
111 | 110 | } |
112 | 111 | |
113 | - $this->logger->warn("Failed to clear all cache: " . $this->cachePrefix . "*"); |
|
112 | + $this->logger->warn("Failed to clear all cache: ".$this->cachePrefix."*"); |
|
114 | 113 | return false; |
115 | 114 | } |
116 | 115 |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace WebStream\Cache\Driver; |
3 | 3 | |
4 | -use WebStream\DI\Injector; |
|
5 | 4 | use WebStream\Module\Container; |
6 | 5 | |
7 | 6 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | public function __construct(Container $cacheContainer) |
31 | 31 | { |
32 | 32 | $this->cacheContainer = $cacheContainer; |
33 | - $this->cachePrefix = $this->cacheContainer->cachePrefix . '.' . $this->cacheContainer->classPrefix . '.'; |
|
33 | + $this->cachePrefix = $this->cacheContainer->cachePrefix.'.'.$this->cacheContainer->classPrefix.'.'; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | - $this->logger->info("Execute cache save: " . $key); |
|
64 | + $this->logger->info("Execute cache save: ".$key); |
|
65 | 65 | |
66 | 66 | return $result; |
67 | 67 | } |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | } |
77 | 77 | |
78 | 78 | $result = $this->cacheContainer->driver->get($key); |
79 | - $this->logger->info("Execute cache read: " . $key); |
|
79 | + $this->logger->info("Execute cache read: ".$key); |
|
80 | 80 | |
81 | 81 | if ($result !== false) { |
82 | - $this->logger->info("Execute cache read: " . $key); |
|
82 | + $this->logger->info("Execute cache read: ".$key); |
|
83 | 83 | } else { |
84 | - $this->logger->warn("Failed to read cache: " . $key); |
|
84 | + $this->logger->warn("Failed to read cache: ".$key); |
|
85 | 85 | $result = null; |
86 | 86 | } |
87 | 87 | |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | if ($this->cacheContainer->driver->delete($key) > 0) { |
101 | - $this->logger->info("Execute cache cleared: " . $key); |
|
101 | + $this->logger->info("Execute cache cleared: ".$key); |
|
102 | 102 | return true; |
103 | 103 | } else { |
104 | - $this->logger->warn("Failed to clear cache: " . $key); |
|
104 | + $this->logger->warn("Failed to clear cache: ".$key); |
|
105 | 105 | return false; |
106 | 106 | } |
107 | 107 | } |
@@ -124,10 +124,10 @@ discard block |
||
124 | 124 | $this->cacheContainer->driver->setOption($this->cacheContainer->redisOptPrefix, $this->cachePrefix); |
125 | 125 | |
126 | 126 | if ($result > 0) { |
127 | - $this->logger->info("Execute all cache cleared: " . $this->cachePrefix . "*"); |
|
127 | + $this->logger->info("Execute all cache cleared: ".$this->cachePrefix."*"); |
|
128 | 128 | return true; |
129 | 129 | } else { |
130 | - $this->logger->warn("Failed to clear all cache: " . $this->cachePrefix . "*"); |
|
130 | + $this->logger->warn("Failed to clear all cache: ".$this->cachePrefix."*"); |
|
131 | 131 | return false; |
132 | 132 | } |
133 | 133 | } |