@@ -69,7 +69,7 @@ |
||
| 69 | 69 | public function __call($methodName, array $arguments = []) |
| 70 | 70 | { |
| 71 | 71 | if (!method_exists($this->driver, $methodName)) { |
| 72 | - throw new Exception('Method `' . $methodName . '` not defined in `' . get_class($this->driver) . '` driver.'); |
|
| 72 | + throw new Exception('Method `'.$methodName.'` not defined in `'.get_class($this->driver).'` driver.'); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | return call_user_func_array([$this->driver, $methodName], $arguments); |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | if ($dirStream = opendir($dirName)) { |
| 35 | 35 | while (false !== ($fileName = readdir($dirStream))) { |
| 36 | 36 | if ($fileName !== '.' && $fileName !== '..') { |
| 37 | - if (is_file($dirName . '/' . $fileName)) { |
|
| 38 | - $totalSize += filesize($dirName . '/' . $fileName); |
|
| 37 | + if (is_file($dirName.'/'.$fileName)) { |
|
| 38 | + $totalSize += filesize($dirName.'/'.$fileName); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if (is_dir($dirName . '/' . $fileName)) { |
|
| 42 | - $totalSize += self::dirSize($dirName . '/' . $fileName); |
|
| 41 | + if (is_dir($dirName.'/'.$fileName)) { |
|
| 42 | + $totalSize += self::dirSize($dirName.'/'.$fileName); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | continue; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - static::removeDir($path . '/' . $dir); |
|
| 73 | + static::removeDir($path.'/'.$dir); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | rmdir($path); |
@@ -93,16 +93,16 @@ discard block |
||
| 93 | 93 | { |
| 94 | 94 | $dir = opendir($src); |
| 95 | 95 | if (!@mkdir($dst, 0777) && !is_dir($dst)) { |
| 96 | - throw new Exception('Copy dir error, access denied for path: ' . $dst); |
|
| 96 | + throw new Exception('Copy dir error, access denied for path: '.$dst); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | while (false !== ($file = readdir($dir))) { |
| 100 | 100 | if (($file !== '.') && ($file !== '..')) { |
| 101 | - if (is_dir($src . '/' . $file)) { |
|
| 102 | - self::recurseCopy($src . '/' . $file, $dst . '/' . $file); |
|
| 101 | + if (is_dir($src.'/'.$file)) { |
|
| 102 | + self::recurseCopy($src.'/'.$file, $dst.'/'.$file); |
|
| 103 | 103 | } else { |
| 104 | - copy($src . '/' . $file, $dst . '/' . $file); |
|
| 105 | - chmod($dst . '/' . $file, 0666); |
|
| 104 | + copy($src.'/'.$file, $dst.'/'.$file); |
|
| 105 | + chmod($dst.'/'.$file, 0666); |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -125,12 +125,12 @@ discard block |
||
| 125 | 125 | public static function recurseCopyIfEdited($src = '', $dst = '', array $excludes = ['php']) |
| 126 | 126 | { |
| 127 | 127 | if (!is_dir($dst) && (!mkdir($dst) && !is_dir($dst))) { |
| 128 | - throw new Exception('Copy dir error, access denied for path: ' . $dst); |
|
| 128 | + throw new Exception('Copy dir error, access denied for path: '.$dst); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | $dir = opendir($src); |
| 132 | 132 | if (!$dir) { |
| 133 | - throw new Exception('Unable to read dir: ' . $src); |
|
| 133 | + throw new Exception('Unable to read dir: '.$src); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | while (false !== ($file = readdir($dir))) { |
@@ -138,8 +138,8 @@ discard block |
||
| 138 | 138 | continue; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - if (is_dir($src . '/' . $file)) { |
|
| 142 | - self::recurseCopyIfEdited($src . '/' . $file, $dst . '/' . $file, $excludes); |
|
| 141 | + if (is_dir($src.'/'.$file)) { |
|
| 142 | + self::recurseCopyIfEdited($src.'/'.$file, $dst.'/'.$file, $excludes); |
|
| 143 | 143 | continue; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -148,12 +148,12 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | |
| 151 | - if (file_exists($dst . '/' . $file) && (filemtime($src . '/' . $file) === filemtime($dst . '/' . $file))) { |
|
| 151 | + if (file_exists($dst.'/'.$file) && (filemtime($src.'/'.$file) === filemtime($dst.'/'.$file))) { |
|
| 152 | 152 | continue; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - copy($src . '/' . $file, $dst . '/' . $file); |
|
| 156 | - chmod($dst . '/' . $file, 0666); |
|
| 155 | + copy($src.'/'.$file, $dst.'/'.$file); |
|
| 156 | + chmod($dst.'/'.$file, 0666); |
|
| 157 | 157 | } |
| 158 | 158 | closedir($dir); |
| 159 | 159 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | protected function getConfig() |
| 227 | 227 | { |
| 228 | - return $this->getAppDir() . '/configs/index.php'; |
|
| 228 | + return $this->getAppDir().'/configs/index.php'; |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /** |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | $output = $this->container->request->isCli() ? new DefaultConsoleCommand([]) : new Response(); |
| 329 | 329 | |
| 330 | 330 | if ($this->container->request->isCli()) { |
| 331 | - $output->data = '"Error #' . $e->getCode() . ' - ' . $e->getMessage() . '"'; |
|
| 331 | + $output->data = '"Error #'.$e->getCode().' - '.$e->getMessage().'"'; |
|
| 332 | 332 | $output->execute(); |
| 333 | 333 | |
| 334 | 334 | return $output; |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | */ |
| 422 | 422 | public function getLogDir() |
| 423 | 423 | { |
| 424 | - return $this->getAppDir() . '/logs'; |
|
| 424 | + return $this->getAppDir().'/logs'; |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | /** |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | */ |
| 432 | 432 | public function getCacheDir() |
| 433 | 433 | { |
| 434 | - return $this->getAppDir() . '/cache/' . $this->getEnvironment(); |
|
| 434 | + return $this->getAppDir().'/cache/'.$this->getEnvironment(); |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | /** |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $cls = $this->getCalculatePath(); |
| 53 | 53 | |
| 54 | 54 | if (!class_exists($cls) || !is_subclass_of($cls, '\Micro\Mvc\Controllers\IController')) { |
| 55 | - throw new Exception('Controller ' . $cls . ' not found or not a valid'); |
|
| 55 | + throw new Exception('Controller '.$cls.' not found or not a valid'); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | return new $cls($this->container, $this->getModules()); |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | protected function prepareExtensions(&$uriBlocks) |
| 103 | 103 | { |
| 104 | 104 | foreach ($uriBlocks as $i => $block) { |
| 105 | - if (file_exists($this->container->kernel->getAppDir() . $this->extensions . '/extensions/' . $block)) { |
|
| 106 | - $this->extensions .= '/Extensions/' . ucfirst($block); |
|
| 105 | + if (file_exists($this->container->kernel->getAppDir().$this->extensions.'/extensions/'.$block)) { |
|
| 106 | + $this->extensions .= '/Extensions/'.ucfirst($block); |
|
| 107 | 107 | |
| 108 | 108 | unset($uriBlocks[$i]); |
| 109 | 109 | } else { |
@@ -127,11 +127,11 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | protected function prepareModules(&$uriBlocks) |
| 129 | 129 | { |
| 130 | - $path = $this->container->kernel->getAppDir() . ($this->extensions ?: ''); |
|
| 130 | + $path = $this->container->kernel->getAppDir().($this->extensions ?: ''); |
|
| 131 | 131 | |
| 132 | 132 | foreach ($uriBlocks as $i => $block) { |
| 133 | - if ($block && file_exists($path . strtolower($this->modules) . '/modules/' . $block)) { |
|
| 134 | - $this->modules .= '/Modules/' . ucfirst($block); |
|
| 133 | + if ($block && file_exists($path.strtolower($this->modules).'/modules/'.$block)) { |
|
| 134 | + $this->modules .= '/Modules/'.ucfirst($block); |
|
| 135 | 135 | |
| 136 | 136 | unset($uriBlocks[$i]); |
| 137 | 137 | } else { |
@@ -153,10 +153,10 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | protected function prepareController(&$uriBlocks) |
| 155 | 155 | { |
| 156 | - $path = $this->container->kernel->getAppDir() . ($this->extensions ?: '') . strtolower($this->modules ?: ''); |
|
| 156 | + $path = $this->container->kernel->getAppDir().($this->extensions ?: '').strtolower($this->modules ?: ''); |
|
| 157 | 157 | $str = array_shift($uriBlocks); |
| 158 | 158 | |
| 159 | - if (file_exists(str_replace('\\', '/', $path . '/controllers/' . ucfirst($str) . 'Controller.php'))) { |
|
| 159 | + if (file_exists(str_replace('\\', '/', $path.'/controllers/'.ucfirst($str).'Controller.php'))) { |
|
| 160 | 160 | $this->controller = $str; |
| 161 | 161 | } else { |
| 162 | 162 | $this->controller = 'default'; |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function getCalculatePath() |
| 191 | 191 | { |
| 192 | - return '\\App' . $this->getExtensions() . $this->getModules() . '\\Controllers\\' . $this->getController(); |
|
| 192 | + return '\\App'.$this->getExtensions().$this->getModules().'\\Controllers\\'.$this->getController(); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | public function getController() |
| 227 | 227 | { |
| 228 | - return ucfirst($this->controller) . 'Controller'; |
|
| 228 | + return ucfirst($this->controller).'Controller'; |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | array_merge($server, ['container' => $this->container]) |
| 61 | 61 | ); |
| 62 | 62 | } else { |
| 63 | - throw new Exception('Cache driver `' . $server['driver'] . '` not found'); |
|
| 63 | + throw new Exception('Cache driver `'.$server['driver'].'` not found'); |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | if (in_array($driver, $this->servers, true)) { |
| 85 | 85 | return $this->servers[$driver]; |
| 86 | 86 | } else { |
| 87 | - throw new Exception('Cache `' . $driver . '` not found.'); |
|
| 87 | + throw new Exception('Cache `'.$driver.'` not found.'); |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | parent::__construct($config); |
| 38 | 38 | |
| 39 | - $path = !empty($config['path']) ? $config['path'] : sys_get_temp_dir() . '/cache'; |
|
| 39 | + $path = !empty($config['path']) ? $config['path'] : sys_get_temp_dir().'/cache'; |
|
| 40 | 40 | if (!@mkdir($path, 0600) && !is_dir($path)) { |
| 41 | - throw new Exception('Can`not create/check access to directory: ' . $path); |
|
| 41 | + throw new Exception('Can`not create/check access to directory: '.$path); |
|
| 42 | 42 | } |
| 43 | 43 | $this->driver = $path; |
| 44 | 44 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function delete($name) |
| 58 | 58 | { |
| 59 | - unlink($this->driver . '/' . $name); |
|
| 59 | + unlink($this->driver.'/'.$name); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function getMeta($id) |
| 82 | 82 | { |
| 83 | - return filesize($this->driver . '/' . $id); |
|
| 83 | + return filesize($this->driver.'/'.$id); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function set($name, $value) |
| 98 | 98 | { |
| 99 | - return file_put_contents($this->driver . '/' . $name, $value); |
|
| 99 | + return file_put_contents($this->driver.'/'.$name, $value); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function get($name) |
| 106 | 106 | { |
| 107 | - return file_get_contents($this->driver . '/' . $name); |
|
| 107 | + return file_get_contents($this->driver.'/'.$name); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function set($name, $value) |
| 100 | 100 | { |
| 101 | - return $this->driver->update($this->table, ['`name`="' . $value . '"'], 'name="' . $name . '"'); |
|
| 101 | + return $this->driver->update($this->table, ['`name`="'.$value.'"'], 'name="'.$name.'"'); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function increment($name, $offset = 1) |
| 141 | 141 | { |
| 142 | - return $this->driver->update($this->table, ['value' => 'value+' . $offset], 'name="' . $name . '"'); |
|
| 142 | + return $this->driver->update($this->table, ['value' => 'value+'.$offset], 'name="'.$name.'"'); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -147,6 +147,6 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public function decrement($name, $offset = 1) |
| 149 | 149 | { |
| 150 | - return $this->driver->update($this->table, ['value' => 'value-' . $offset], 'name="' . $name . '"'); |
|
| 150 | + return $this->driver->update($this->table, ['value' => 'value-'.$offset], 'name="'.$name.'"'); |
|
| 151 | 151 | } |
| 152 | 152 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | protected function createIPCSegment() |
| 91 | 91 | { |
| 92 | - $this->fileIPC1 = '/tmp/' . mt_rand() . md5($this->getName()) . '.shm'; |
|
| 92 | + $this->fileIPC1 = '/tmp/'.mt_rand().md5($this->getName()).'.shm'; |
|
| 93 | 93 | |
| 94 | 94 | touch($this->fileIPC1); |
| 95 | 95 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | protected function createIPCSemaphore() |
| 143 | 143 | { |
| 144 | - $this->fileIPC2 = '/tmp/' . mt_rand() . md5($this->getName()) . '.sem'; |
|
| 144 | + $this->fileIPC2 = '/tmp/'.mt_rand().md5($this->getName()).'.sem'; |
|
| 145 | 145 | |
| 146 | 146 | touch($this->fileIPC2); |
| 147 | 147 | |
@@ -217,8 +217,8 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | if ($shm_bytes_written !== strlen($serialized_IPC_array)) { |
| 219 | 219 | throw new Exception( |
| 220 | - 'Fatal exception writing SHM segment (shmop_write)' . strlen($serialized_IPC_array) . |
|
| 221 | - '-' . shmop_size($this->internalIPCKey) |
|
| 220 | + 'Fatal exception writing SHM segment (shmop_write)'.strlen($serialized_IPC_array). |
|
| 221 | + '-'.shmop_size($this->internalIPCKey) |
|
| 222 | 222 | ); |
| 223 | 223 | } |
| 224 | 224 | } |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | $serialized_IPC_array = shmop_read($this->internalIPCKey, 0, shmop_size($this->internalIPCKey)); |
| 270 | 270 | |
| 271 | 271 | if (!$serialized_IPC_array) { |
| 272 | - throw new Exception('Fatal exception reading SHM segment (shmop_read)' . "\n"); |
|
| 272 | + throw new Exception('Fatal exception reading SHM segment (shmop_read)'."\n"); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | unset($this->internalIPCArray); |
@@ -49,8 +49,8 @@ |
||
| 49 | 49 | */ |
| 50 | 50 | public function action($name) |
| 51 | 51 | { |
| 52 | - $command = '\\App\\Consoles\\' . ucfirst($name) . 'ConsoleCommand'; |
|
| 53 | - $command = class_exists($command) ? $command : '\\Micro\\Cli\\Consoles\\' . ucfirst($name) . 'ConsoleCommand'; |
|
| 52 | + $command = '\\App\\Consoles\\'.ucfirst($name).'ConsoleCommand'; |
|
| 53 | + $command = class_exists($command) ? $command : '\\Micro\\Cli\\Consoles\\'.ucfirst($name).'ConsoleCommand'; |
|
| 54 | 54 | |
| 55 | 55 | if (!class_exists($command)) { |
| 56 | 56 | return false; |