@@ -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,9 +30,9 @@ discard block |
||
| 30 | 30 | public function __construct(Container $cacheContainer) |
| 31 | 31 | { |
| 32 | 32 | $this->cacheContainer = $cacheContainer; |
| 33 | - $this->cachePrefix = $this->cacheContainer->cachePrefix . '.'; |
|
| 33 | + $this->cachePrefix = $this->cacheContainer->cachePrefix.'.'; |
|
| 34 | 34 | if (!empty($this->cacheContainer->classPrefix)) { |
| 35 | - $this->cachePrefix .= $this->cacheContainer->classPrefix . '.'; |
|
| 35 | + $this->cachePrefix .= $this->cacheContainer->classPrefix.'.'; |
|
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | |
@@ -44,11 +44,10 @@ discard block |
||
| 44 | 44 | if (!$this->isAvailableCacheLibrary()) { |
| 45 | 45 | return false; |
| 46 | 46 | } |
| 47 | - $key = $this->cachePrefix . $key; |
|
| 47 | + $key = $this->cachePrefix.$key; |
|
| 48 | 48 | |
| 49 | - $result = $overwrite ? $this->cacheContainer->driver->delegate("apcu_store", [$key, $value, $ttl]) : |
|
| 50 | - $this->cacheContainer->driver->delegate("apcu_add", [$key, $value, $ttl]); |
|
| 51 | - $this->logger->info("Execute cache save: " . $key); |
|
| 49 | + $result = $overwrite ? $this->cacheContainer->driver->delegate("apcu_store", [$key, $value, $ttl]) : $this->cacheContainer->driver->delegate("apcu_add", [$key, $value, $ttl]); |
|
| 50 | + $this->logger->info("Execute cache save: ".$key); |
|
| 52 | 51 | |
| 53 | 52 | return $result; |
| 54 | 53 | } |
@@ -61,13 +60,13 @@ discard block |
||
| 61 | 60 | if (!$this->isAvailableCacheLibrary()) { |
| 62 | 61 | return null; |
| 63 | 62 | } |
| 64 | - $key = $this->cachePrefix . $key; |
|
| 63 | + $key = $this->cachePrefix.$key; |
|
| 65 | 64 | $value = $this->cacheContainer->driver->delegate("apcu_fetch", [$key]); |
| 66 | 65 | |
| 67 | 66 | if ($value !== false) { |
| 68 | - $this->logger->info("Execute cache read: " . $key); |
|
| 67 | + $this->logger->info("Execute cache read: ".$key); |
|
| 69 | 68 | } else { |
| 70 | - $this->logger->warn("Failed to read cache: " . $key); |
|
| 69 | + $this->logger->warn("Failed to read cache: ".$key); |
|
| 71 | 70 | $value = null; |
| 72 | 71 | } |
| 73 | 72 | |
@@ -82,13 +81,13 @@ discard block |
||
| 82 | 81 | if (!$this->isAvailableCacheLibrary()) { |
| 83 | 82 | return false; |
| 84 | 83 | } |
| 85 | - $key = $this->cachePrefix . $key; |
|
| 84 | + $key = $this->cachePrefix.$key; |
|
| 86 | 85 | |
| 87 | 86 | if ($this->cacheContainer->driver->delegate("apcu_delete", [$key])) { |
| 88 | - $this->logger->info("Execute cache cleared: " . $key); |
|
| 87 | + $this->logger->info("Execute cache cleared: ".$key); |
|
| 89 | 88 | return true; |
| 90 | 89 | } else { |
| 91 | - $this->logger->warn("Failed to clear cache: " . $key); |
|
| 90 | + $this->logger->warn("Failed to clear cache: ".$key); |
|
| 92 | 91 | return false; |
| 93 | 92 | } |
| 94 | 93 | } |
@@ -103,17 +102,17 @@ discard block |
||
| 103 | 102 | } |
| 104 | 103 | |
| 105 | 104 | if (class_exists('\APCUIterator')) { |
| 106 | - $obj = new \APCUIterator('/^' . $this->cachePrefix . '/', APC_ITER_KEY); |
|
| 105 | + $obj = new \APCUIterator('/^'.$this->cachePrefix.'/', APC_ITER_KEY); |
|
| 107 | 106 | if ($this->cacheContainer->driver->delegate("apcu_delete", [$obj])) { |
| 108 | - $this->logger->info("Execute all cache cleared: " . $this->cachePrefix . "*"); |
|
| 107 | + $this->logger->info("Execute all cache cleared: ".$this->cachePrefix."*"); |
|
| 109 | 108 | return true; |
| 110 | 109 | } |
| 111 | 110 | } elseif ($this->cacheContainer->driver->delegate("apcu_clear_cache")) { |
| 112 | - $this->logger->info("Execute all cache cleared: " . $this->cachePrefix . "*"); |
|
| 111 | + $this->logger->info("Execute all cache cleared: ".$this->cachePrefix."*"); |
|
| 113 | 112 | return true; |
| 114 | 113 | } |
| 115 | 114 | |
| 116 | - $this->logger->warn("Failed to clear all cache: " . $this->cachePrefix . "*"); |
|
| 115 | + $this->logger->warn("Failed to clear all cache: ".$this->cachePrefix."*"); |
|
| 117 | 116 | return false; |
| 118 | 117 | } |
| 119 | 118 | |
@@ -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 | } |
@@ -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 | /** |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | public function __construct(Container $cacheContainer) |
| 34 | 34 | { |
| 35 | 35 | $this->cacheContainer = $cacheContainer; |
| 36 | - $this->cachePrefix = $this->cacheContainer->cachePrefix . '.' . $this->cacheContainer->classPrefix . '.'; |
|
| 36 | + $this->cachePrefix = $this->cacheContainer->cachePrefix.'.'.$this->cacheContainer->classPrefix.'.'; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | if (!$this->isAvailableCacheLibrary()) { |
| 45 | 45 | return false; |
| 46 | 46 | } |
| 47 | - $key = $this->cachePrefix . $key; |
|
| 47 | + $key = $this->cachePrefix.$key; |
|
| 48 | 48 | $writer = null; |
| 49 | 49 | $isAppend = !$overwrite; |
| 50 | 50 | |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | ]); |
| 56 | 56 | |
| 57 | 57 | try { |
| 58 | - $file = new File($this->cacheContainer->cacheDir . '/' . $key . '.cache'); |
|
| 58 | + $file = new File($this->cacheContainer->cacheDir.'/'.$key.'.cache'); |
|
| 59 | 59 | $writer = $this->cacheContainer->ioContainer->fileWriter->getWriter($file, $isAppend); |
| 60 | 60 | $writer->write($value); |
| 61 | - $this->logger->info("Execute cache save: " . $key); |
|
| 61 | + $this->logger->info("Execute cache save: ".$key); |
|
| 62 | 62 | return true; |
| 63 | 63 | } catch (IOException $e) { |
| 64 | 64 | $this->logger->warn($e->getMessage()); |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | if (!$this->isAvailableCacheLibrary()) { |
| 83 | 83 | return null; |
| 84 | 84 | } |
| 85 | - $key = $this->cachePrefix . $key; |
|
| 85 | + $key = $this->cachePrefix.$key; |
|
| 86 | 86 | $value = null; |
| 87 | 87 | $reader = null; |
| 88 | - $file = new File($this->cacheContainer->cacheDir . '/' . $key . '.cache'); |
|
| 88 | + $file = new File($this->cacheContainer->cacheDir.'/'.$key.'.cache'); |
|
| 89 | 89 | |
| 90 | 90 | if ($file->isReadable()) { |
| 91 | 91 | try { |
@@ -93,12 +93,12 @@ discard block |
||
| 93 | 93 | $data = $this->decode($reader->read()); |
| 94 | 94 | if ($data['ttl'] > 0) { |
| 95 | 95 | if (time() > $data['time'] + $data['ttl']) { |
| 96 | - $this->logger->info("Expired cache: " . $key); |
|
| 96 | + $this->logger->info("Expired cache: ".$key); |
|
| 97 | 97 | $file->delete(); |
| 98 | 98 | } |
| 99 | 99 | } else { |
| 100 | 100 | $value = $data['data']; |
| 101 | - $this->logger->info("Execute cache read: " . $key); |
|
| 101 | + $this->logger->info("Execute cache read: ".$key); |
|
| 102 | 102 | } |
| 103 | 103 | } catch (IOException $e) { |
| 104 | 104 | $this->logger->warn($e->getMessage()); |
@@ -124,19 +124,19 @@ discard block |
||
| 124 | 124 | if (!$this->isAvailableCacheLibrary()) { |
| 125 | 125 | return false; |
| 126 | 126 | } |
| 127 | - $key = $this->cachePrefix . $key; |
|
| 127 | + $key = $this->cachePrefix.$key; |
|
| 128 | 128 | $result = false; |
| 129 | 129 | |
| 130 | - $file = new File($this->cacheContainer->cacheDir . '/' . $key . '.cache'); |
|
| 130 | + $file = new File($this->cacheContainer->cacheDir.'/'.$key.'.cache'); |
|
| 131 | 131 | if ($file->isWritable()) { |
| 132 | 132 | $result = $file->delete(); |
| 133 | 133 | if ($result) { |
| 134 | - $this->logger->info("Execute cache cleared: " . $key); |
|
| 134 | + $this->logger->info("Execute cache cleared: ".$key); |
|
| 135 | 135 | } else { |
| 136 | - $this->logger->warn("Failed to clear cache: " . $key); |
|
| 136 | + $this->logger->warn("Failed to clear cache: ".$key); |
|
| 137 | 137 | } |
| 138 | 138 | } else { |
| 139 | - $this->logger->warn("Failed to clear cache: " . $key); |
|
| 139 | + $this->logger->warn("Failed to clear cache: ".$key); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | return $result; |
@@ -161,9 +161,9 @@ discard block |
||
| 161 | 161 | $file = new File($filepath); |
| 162 | 162 | if ($file->isWritable()) { |
| 163 | 163 | if ($file->delete()) { |
| 164 | - $this->logger->info("Execute cache cleared: " . $this->cachePrefix . "*"); |
|
| 164 | + $this->logger->info("Execute cache cleared: ".$this->cachePrefix."*"); |
|
| 165 | 165 | } else { |
| 166 | - $this->logger->warn("Failed to clear cache: " . $this->cachePrefix . "*"); |
|
| 166 | + $this->logger->warn("Failed to clear cache: ".$this->cachePrefix."*"); |
|
| 167 | 167 | $result = false; |
| 168 | 168 | } |
| 169 | 169 | } else { |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | } else { |
| 179 | - $this->logger->warn("Can't read directory:" . $dir->getFilePath()); |
|
| 179 | + $this->logger->warn("Can't read directory:".$dir->getFilePath()); |
|
| 180 | 180 | $result = false; |
| 181 | 181 | } |
| 182 | 182 | |
@@ -141,7 +141,7 @@ |
||
| 141 | 141 | $cacheContainer->driver->setOption(\Redis::OPT_SERIALIZER, \Redis::SERIALIZER_IGBINARY); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - $cacheContainer->driver->setOption(\Redis::OPT_PREFIX, $container->cachePrefix . '.' . $container->classPrefix); |
|
| 144 | + $cacheContainer->driver->setOption(\Redis::OPT_PREFIX, $container->cachePrefix.'.'.$container->classPrefix); |
|
| 145 | 145 | $cacheContainer->driver->setOption(\Redis::OPT_SCAN, \Redis::SCAN_RETRY); |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -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,7 +41,7 @@ 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 | $result = null; |
| 46 | 46 | |
| 47 | 47 | if ($ttl > 0) { |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $this->logger->info("Execute cache save: " . $key); |
|
| 67 | + $this->logger->info("Execute cache save: ".$key); |
|
| 68 | 68 | $this->verifyReturnCode($this->cacheContainer->codes['success']); |
| 69 | 69 | |
| 70 | 70 | return $result; |
@@ -78,13 +78,13 @@ discard block |
||
| 78 | 78 | if (!$this->isAvailableCacheLibrary()) { |
| 79 | 79 | return false; |
| 80 | 80 | } |
| 81 | - $key = $this->cachePrefix . $key; |
|
| 81 | + $key = $this->cachePrefix.$key; |
|
| 82 | 82 | $result = $this->cacheContainer->driver->get($key); |
| 83 | 83 | |
| 84 | 84 | if ($result !== false) { |
| 85 | - $this->logger->info("Execute cache read: " . $key); |
|
| 85 | + $this->logger->info("Execute cache read: ".$key); |
|
| 86 | 86 | } else { |
| 87 | - $this->logger->warn("Failed to read cache: " . $key); |
|
| 87 | + $this->logger->warn("Failed to read cache: ".$key); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | return $this->verifyReturnCode($this->cacheContainer->codes['success']) ? $result : null; |
@@ -98,14 +98,14 @@ discard block |
||
| 98 | 98 | if (!$this->isAvailableCacheLibrary()) { |
| 99 | 99 | return false; |
| 100 | 100 | } |
| 101 | - $key = $this->cachePrefix . $key; |
|
| 101 | + $key = $this->cachePrefix.$key; |
|
| 102 | 102 | $this->cacheContainer->driver->delete($key); |
| 103 | 103 | |
| 104 | 104 | if ($this->verifyReturnCode($this->cacheContainer->codes['notfound'])) { |
| 105 | - $this->logger->info("Execute cache cleared: " . $key); |
|
| 105 | + $this->logger->info("Execute cache cleared: ".$key); |
|
| 106 | 106 | return true; |
| 107 | 107 | } else { |
| 108 | - $this->logger->warn("Failed to clear cache: " . $key); |
|
| 108 | + $this->logger->warn("Failed to clear cache: ".$key); |
|
| 109 | 109 | return false; |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | $allKeys = $this->cacheContainer->driver->getAllKeys(); |
| 122 | 122 | if ($allKeys === false) { |
| 123 | - $this->logger->warn("Can't get cache keys: " . $this->cachePrefix . "*"); |
|
| 123 | + $this->logger->warn("Can't get cache keys: ".$this->cachePrefix."*"); |
|
| 124 | 124 | $this->cacheContainer->driver->flush(); |
| 125 | 125 | |
| 126 | 126 | return true; |
@@ -137,10 +137,10 @@ discard block |
||
| 137 | 137 | $this->cacheContainer->driver->deleteMulti($targetKeys); |
| 138 | 138 | |
| 139 | 139 | if ($this->verifyReturnCode($this->cacheContainer->codes['notfound'])) { |
| 140 | - $this->logger->info("Execute all cache cleared: " . $this->cachePrefix . "*"); |
|
| 140 | + $this->logger->info("Execute all cache cleared: ".$this->cachePrefix."*"); |
|
| 141 | 141 | return true; |
| 142 | 142 | } else { |
| 143 | - $this->logger->warn("Failed to clear all cache: " . $this->cachePrefix . "*"); |
|
| 143 | + $this->logger->warn("Failed to clear all cache: ".$this->cachePrefix."*"); |
|
| 144 | 144 | return false; |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -181,11 +181,11 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | // テンプレートキャッシュチェック |
| 183 | 183 | $pageName = $this->container->coreDelegator->getPageName(); |
| 184 | - $cacheFile = $applicationInfo->cachePrefix . $this->camel2snake($pageName) . "-" . $this->camel2snake($method); |
|
| 184 | + $cacheFile = $applicationInfo->cachePrefix.$this->camel2snake($pageName)."-".$this->camel2snake($method); |
|
| 185 | 185 | |
| 186 | 186 | $factory = new CacheDriverFactory(); |
| 187 | 187 | $config = new Container(false); |
| 188 | - $config->cacheDir = $applicationInfo->applicationRoot . "/app/views/" . $applicationInfo->cacheDir; |
|
| 188 | + $config->cacheDir = $applicationInfo->applicationRoot."/app/views/".$applicationInfo->cacheDir; |
|
| 189 | 189 | $config->classPrefix = "view_cache"; |
| 190 | 190 | $cache = $factory->create("WebStream\Cache\Driver\TemporaryFile", $config); |
| 191 | 191 | $cache->inject('logger', $this->logger); |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | ]); |
| 255 | 255 | |
| 256 | 256 | if ($template->cacheTime !== null) { |
| 257 | - $cacheFile = $applicationInfo->cachePrefix . $this->camel2snake($pageName) . "-" . $this->camel2snake($method); |
|
| 257 | + $cacheFile = $applicationInfo->cachePrefix.$this->camel2snake($pageName)."-".$this->camel2snake($method); |
|
| 258 | 258 | $view->templateCache($cacheFile, ob_get_contents(), $template->cacheTime); |
| 259 | 259 | } |
| 260 | 260 | |