@@ -25,12 +25,12 @@ |
||
| 25 | 25 | { |
| 26 | 26 | foreach ($this->elements AS $element) { |
| 27 | 27 | if (!$model->checkAttributeExists($element)) { |
| 28 | - $this->errors[] = 'Parameter ' . $element . ' not defined in class ' . get_class($model); |
|
| 28 | + $this->errors[] = 'Parameter '.$element.' not defined in class '.get_class($model); |
|
| 29 | 29 | |
| 30 | 30 | return false; |
| 31 | 31 | } |
| 32 | 32 | if (!is_numeric($model->$element)) { |
| 33 | - $this->errors[] = 'Parameter ' . $element . ' is not a numeric'; |
|
| 33 | + $this->errors[] = 'Parameter '.$element.' is not a numeric'; |
|
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | foreach ($this->elements AS $element) { |
| 27 | 27 | if (!$model->checkAttributeExists($element)) { |
| 28 | - $this->errors[] = 'Parameter ' . $element . ' not defined in class ' . get_class($model); |
|
| 28 | + $this->errors[] = 'Parameter '.$element.' not defined in class '.get_class($model); |
|
| 29 | 29 | |
| 30 | 30 | return false; |
| 31 | 31 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | if (!empty($this->params['min'])) { |
| 34 | 34 | $this->params['min'] = filter_var($this->params['min'], FILTER_VALIDATE_INT); |
| 35 | 35 | if ($this->params['min'] > $elementLength) { |
| 36 | - $this->errors[] = $element . ' error: minimal characters not valid.'; |
|
| 36 | + $this->errors[] = $element.' error: minimal characters not valid.'; |
|
| 37 | 37 | |
| 38 | 38 | return false; |
| 39 | 39 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | if (!empty($this->params['max'])) { |
| 42 | 42 | $this->params['max'] = filter_var($this->params['max'], FILTER_VALIDATE_INT); |
| 43 | 43 | if ($this->params['max'] < $elementLength) { |
| 44 | - $this->errors[] = $element . ' error: maximal characters not valid.'; |
|
| 44 | + $this->errors[] = $element.' error: maximal characters not valid.'; |
|
| 45 | 45 | |
| 46 | 46 | return false; |
| 47 | 47 | } |
@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | $action = ''; |
| 60 | 60 | if (!empty($this->params['min'])) { |
| 61 | - $action .= ' if (this.value.length < ' . $this->params['min'] . ') { e.preventDefault(); this.focus();' . |
|
| 62 | - ' alert(\'Value lowest, minimum ' . $this->params['min'] . ' symbols\'); }'; |
|
| 61 | + $action .= ' if (this.value.length < '.$this->params['min'].') { e.preventDefault(); this.focus();'. |
|
| 62 | + ' alert(\'Value lowest, minimum '.$this->params['min'].' symbols\'); }'; |
|
| 63 | 63 | } |
| 64 | 64 | if (!empty($this->params['max'])) { |
| 65 | - $action .= ' if (this.value.length > ' . $this->params['max'] . ') { e.preventDefault(); this.focus();' . |
|
| 66 | - ' alert(\'Value highest, maximum ' . $this->params['max'] . ' symbols\'); }'; |
|
| 65 | + $action .= ' if (this.value.length > '.$this->params['max'].') { e.preventDefault(); this.focus();'. |
|
| 66 | + ' alert(\'Value highest, maximum '.$this->params['max'].' symbols\'); }'; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | return $action; |
@@ -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 | } |