@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | break; |
| 68 | 68 | |
| 69 | 69 | default: |
| 70 | - throw new Exception('Service type `' . $type . '` wrong name.'); |
|
| 70 | + throw new Exception('Service type `'.$type.'` wrong name.'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | return $broker->{$type}($route, $data); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | if (!$server) { |
| 102 | - throw new Exception('Message not send, random servers is down into `' . $uri . '`'); |
|
| 102 | + throw new Exception('Message not send, random servers is down into `'.$uri.'`'); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | return $this->brokers[$server]; |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $servers += $route['*']; |
| 134 | 134 | } |
| 135 | 135 | if (!$servers) { |
| 136 | - throw new Exception('Type `' . $type . '` not found into route'); |
|
| 136 | + throw new Exception('Type `'.$type.'` not found into route'); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | return $servers; |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $keys = array_keys($this->routes); |
| 155 | 155 | |
| 156 | 156 | foreach (range(0, count($keys) - 1) AS $i) { |
| 157 | - if (preg_match('/' . $keys[$i] . '/', $uri)) { |
|
| 157 | + if (preg_match('/'.$keys[$i].'/', $uri)) { |
|
| 158 | 158 | if (!is_array($this->routes[$keys[$i]])) { |
| 159 | 159 | $this->routes[$keys[$i]] = ['*' => $this->routes[$keys[$i]]]; |
| 160 | 160 | } |
@@ -162,6 +162,6 @@ discard block |
||
| 162 | 162 | return $this->routes[$keys[$i]]; |
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | - throw new Exception('Route `' . $uri . '` not found'); |
|
| 165 | + throw new Exception('Route `'.$uri.'` not found'); |
|
| 166 | 166 | } |
| 167 | 167 | } |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | $path = dirname( |
| 34 | 34 | str_replace(['\\', 'App'], ['/', $container->kernel->getAppDir()], get_called_class()) |
| 35 | - ) . '/config.php'; |
|
| 35 | + ).'/config.php'; |
|
| 36 | 36 | |
| 37 | 37 | if (file_exists($path)) { |
| 38 | 38 | $container->load($path); |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | |
| 47 | 47 | // if module defined |
| 48 | 48 | if ($modules) { |
| 49 | - $className = '\\App' . $modules . '\\' . ucfirst(basename(str_replace('\\', '/', $modules))) . 'Module'; |
|
| 49 | + $className = '\\App'.$modules.'\\'.ucfirst(basename(str_replace('\\', '/', $modules))).'Module'; |
|
| 50 | 50 | |
| 51 | 51 | if (class_exists($className) && is_subclass_of($className, '\Micro\Mvc\Module')) { |
| 52 | 52 | $this->module = new $className($this->container); |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | $actionClass = false; |
| 51 | 51 | |
| 52 | 52 | // check action exists |
| 53 | - if (!method_exists($this, 'action' . ucfirst($name)) && !$actionClass = $this->getActionClassByName($name)) { |
|
| 54 | - $this->response->setStatus(500, 'Action "' . $name . '" not found into ' . get_class($this)); |
|
| 53 | + if (!method_exists($this, 'action'.ucfirst($name)) && !$actionClass = $this->getActionClassByName($name)) { |
|
| 54 | + $this->response->setStatus(500, 'Action "'.$name.'" not found into '.get_class($this)); |
|
| 55 | 55 | |
| 56 | 56 | return $this->response; |
| 57 | 57 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | if (!empty($types[$name]) && $this->methodType !== $types[$name]) { |
| 62 | 62 | $this->response->setStatus(500, |
| 63 | - 'Action "' . $name . '" not run with method "' . $this->methodType . '" into ' . get_class($this) |
|
| 63 | + 'Action "'.$name.'" not run with method "'.$this->methodType.'" into '.get_class($this) |
|
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | 66 | return $this->response; |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $cl = new $actionClass($this->container); |
| 77 | 77 | $view = $cl->run(); |
| 78 | 78 | } else { |
| 79 | - $view = $this->{'action' . ucfirst($name)}(); |
|
| 79 | + $view = $this->{'action'.ucfirst($name)}(); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | if ($this->response->getContentType() !== $this->format) { |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | $view = null; |
| 41 | 41 | $actionClass = false; |
| 42 | 42 | |
| 43 | - if (!method_exists($this, 'action' . ucfirst($name))) { |
|
| 43 | + if (!method_exists($this, 'action'.ucfirst($name))) { |
|
| 44 | 44 | $actionClass = $this->getActionClassByName($name); |
| 45 | 45 | if (!$actionClass) { |
| 46 | - throw new Exception('Action "' . $name . '" not found into ' . get_class($this)); |
|
| 46 | + throw new Exception('Action "'.$name.'" not found into '.get_class($this)); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $cl = new $actionClass($this->container); |
| 60 | 60 | $view = $cl->run(); |
| 61 | 61 | } else { |
| 62 | - $view = $this->{'action' . ucfirst($name)}(); |
|
| 62 | + $view = $this->{'action'.ucfirst($name)}(); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if (is_object($view)) { |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | public function widget($name, array $options = [], $capture = false) |
| 58 | 58 | { |
| 59 | 59 | if (!class_exists($name)) { |
| 60 | - throw new Exception('Widget ' . $name . ' not found.'); |
|
| 60 | + throw new Exception('Widget '.$name.' not found.'); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $options = array_merge($options, ['container' => $this->container]); |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | public function beginWidget($name, array $options = []) |
| 99 | 99 | { |
| 100 | 100 | if (!class_exists($name)) { |
| 101 | - throw new Exception('Widget ' . $name . ' not found.'); |
|
| 101 | + throw new Exception('Widget '.$name.' not found.'); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | if (!empty($GLOBALS['widgetStack'][$name])) { |
| 105 | - throw new Exception('This widget (' . $name . ') already started!'); |
|
| 105 | + throw new Exception('This widget ('.$name.') already started!'); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | $options = array_merge($options, ['container' => $this->container]); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (!class_exists($name) || empty($GLOBALS['widgetStack'][$name])) { |
| 139 | - throw new Exception('Widget ' . $name . ' not started.'); |
|
| 139 | + throw new Exception('Widget '.$name.' not started.'); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** @var \Micro\mvc\Widget $widget widget */ |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | if ($this->layout && (!$layoutPath = $this->getLayoutFile($this->container->kernel->getAppDir(), |
| 91 | 91 | $this->module)) |
| 92 | 92 | ) { |
| 93 | - $this->container->logger->send('error', 'Layout `' . $this->layout . '` not found'); |
|
| 93 | + $this->container->logger->send('error', 'Layout `'.$this->layout.'` not found'); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | if ($layoutPath) { |
@@ -119,15 +119,15 @@ discard block |
||
| 119 | 119 | $module = substr($module, 0, strrpos($module, '/')); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - $layout = $appDir . '/' . ($module ? $module . '/' : $module); |
|
| 123 | - $afterPath = 'views/layouts/' . ucfirst($this->layout) . '.php'; |
|
| 122 | + $layout = $appDir.'/'.($module ? $module.'/' : $module); |
|
| 123 | + $afterPath = 'views/layouts/'.ucfirst($this->layout).'.php'; |
|
| 124 | 124 | |
| 125 | - if (file_exists($layout . $afterPath)) { |
|
| 126 | - return $layout . $afterPath; |
|
| 125 | + if (file_exists($layout.$afterPath)) { |
|
| 126 | + return $layout.$afterPath; |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if (file_exists($appDir . '/' . $afterPath)) { |
|
| 130 | - return $appDir . '/' . $afterPath; |
|
| 129 | + if (file_exists($appDir.'/'.$afterPath)) { |
|
| 130 | + return $appDir.'/'.$afterPath; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | return false; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | include str_replace('\\', '/', $fileName); |
| 157 | 157 | |
| 158 | 158 | if (!empty($GLOBALS['widgetStack'])) { |
| 159 | - throw new Exception(count($GLOBALS['widgetStack']) . ' widgets not endings.'); |
|
| 159 | + throw new Exception(count($GLOBALS['widgetStack']).' widgets not endings.'); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | return ob_get_clean(); |
@@ -187,17 +187,17 @@ discard block |
||
| 187 | 187 | $cl = substr($cl, strpos($cl, '/')); |
| 188 | 188 | |
| 189 | 189 | if ($this->asWidget) { |
| 190 | - $path .= $cl . '/views/' . $view . '.php'; |
|
| 190 | + $path .= $cl.'/views/'.$view.'.php'; |
|
| 191 | 191 | } else { |
| 192 | 192 | $className = str_replace('controller', '', |
| 193 | - strtolower(basename(str_replace('\\', '/', '/' . $this->path)))); |
|
| 194 | - $path .= dirname($cl) . '/views/' . $className . '/' . $view . '.php'; |
|
| 193 | + strtolower(basename(str_replace('\\', '/', '/'.$this->path)))); |
|
| 194 | + $path .= dirname($cl).'/views/'.$className.'/'.$view.'.php'; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | $path = str_replace('//', '/', $path); |
| 198 | 198 | |
| 199 | 199 | if (!file_exists($path)) { |
| 200 | - throw new Exception('View path `' . $path . '` not exists.'); |
|
| 200 | + throw new Exception('View path `'.$path.'` not exists.'); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | return $path; |
@@ -67,8 +67,8 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function addSearch($column, $keyword, $escaped = false, $operand = 'AND') |
| 69 | 69 | { |
| 70 | - $keyword = $escaped ? $keyword : '"%' . $keyword . '%"'; |
|
| 71 | - $this->addWhere($column . ' LIKE ' . $keyword, $operand); |
|
| 70 | + $keyword = $escaped ? $keyword : '"%'.$keyword.'%"'; |
|
| 71 | + $this->addWhere($column.' LIKE '.$keyword, $operand); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function addWhere($sql, $operand = 'AND') |
| 78 | 78 | { |
| 79 | - $this->where .= $this->where ? ' ' . $operand . ' (' . $sql . ')' : ' ' . $this->where . ' (' . $sql . ')'; |
|
| 79 | + $this->where .= $this->where ? ' '.$operand.' ('.$sql.')' : ' '.$this->where.' ('.$sql.')'; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function addNotSearch($column, $keyword, $escaped, $operand = 'AND') |
| 86 | 86 | { |
| 87 | - $keyword = $escaped ? $keyword : '"%' . $keyword . '%"'; |
|
| 88 | - $this->addWhere($column . ' NOT LIKE ' . $keyword, $operand); |
|
| 87 | + $keyword = $escaped ? $keyword : '"%'.$keyword.'%"'; |
|
| 88 | + $this->addWhere($column.' NOT LIKE '.$keyword, $operand); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -94,10 +94,10 @@ discard block |
||
| 94 | 94 | public function addIn($column, $params, $operand = 'AND') |
| 95 | 95 | { |
| 96 | 96 | if (is_array($params)) { |
| 97 | - $params = "'" . implode('\',\'', $params) . '\''; |
|
| 97 | + $params = "'".implode('\',\'', $params).'\''; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $this->addWhere($column . ' IN (' . $params . ')', $operand); |
|
| 100 | + $this->addWhere($column.' IN ('.$params.')', $operand); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -106,10 +106,10 @@ discard block |
||
| 106 | 106 | public function addNotIn($column, $params, $operand = 'AND') |
| 107 | 107 | { |
| 108 | 108 | if (is_array($params)) { |
| 109 | - $params = "'" . implode('\',\'', $params) . '\''; |
|
| 109 | + $params = "'".implode('\',\'', $params).'\''; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - $this->addWhere($column . ' NOT IN (' . $params . ')', $operand); |
|
| 112 | + $this->addWhere($column.' NOT IN ('.$params.')', $operand); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function addBetween($column, $start, $stop, $operand = 'AND') |
| 119 | 119 | { |
| 120 | - $this->addWhere($column . ' BETWEEN ' . $start . ' AND ' . $stop, $operand); |
|
| 120 | + $this->addWhere($column.' BETWEEN '.$start.' AND '.$stop, $operand); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function addNotBetween($column, $start, $stop, $operand = 'AND') |
| 127 | 127 | { |
| 128 | - $this->addWhere($column . ' BETWEEN ' . $start . ' AND ' . $stop, $operand); |
|
| 128 | + $this->addWhere($column.' BETWEEN '.$start.' AND '.$stop, $operand); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | public function addJoin($table, $condition, $type = 'LEFT') |
| 135 | 135 | { |
| 136 | - $this->join .= ' ' . $type . ' JOIN ' . $table . ' ON ' . $condition; |
|
| 136 | + $this->join .= ' '.$type.' JOIN '.$table.' ON '.$condition; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -156,18 +156,18 @@ discard block |
||
| 156 | 156 | { |
| 157 | 157 | $query = 'SELECT '; |
| 158 | 158 | $query .= $this->distinct ? 'DISTINCT ' : ''; |
| 159 | - $query .= $this->select . ' FROM ' . $this->table; |
|
| 160 | - $query .= $this->join ? ' ' . $this->join : ''; |
|
| 161 | - $query .= $this->where ? ' WHERE ' . $this->where : ''; |
|
| 162 | - $query .= $this->group ? ' GROUP BY ' . $this->group : ''; |
|
| 163 | - $query .= $this->having ? ' HAVING ' . $this->having : ''; |
|
| 164 | - $query .= $this->order ? ' ORDER BY ' . $this->order : ''; |
|
| 159 | + $query .= $this->select.' FROM '.$this->table; |
|
| 160 | + $query .= $this->join ? ' '.$this->join : ''; |
|
| 161 | + $query .= $this->where ? ' WHERE '.$this->where : ''; |
|
| 162 | + $query .= $this->group ? ' GROUP BY '.$this->group : ''; |
|
| 163 | + $query .= $this->having ? ' HAVING '.$this->having : ''; |
|
| 164 | + $query .= $this->order ? ' ORDER BY '.$this->order : ''; |
|
| 165 | 165 | |
| 166 | 166 | if ($this->limit !== -1) { |
| 167 | 167 | $query .= ' LIMIT '; |
| 168 | 168 | |
| 169 | 169 | if ($this->offset !== -1) { |
| 170 | - $query .= $this->offset . ','; |
|
| 170 | + $query .= $this->offset.','; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | $query .= $this->limit; |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | { |
| 81 | 81 | $query = new Query($container->db); |
| 82 | 82 | foreach ($attributes AS $key => $val) { |
| 83 | - $query->addWhere($key . ' = :' . $key); |
|
| 83 | + $query->addWhere($key.' = :'.$key); |
|
| 84 | 84 | } |
| 85 | 85 | $query->params = $attributes; |
| 86 | 86 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | public static function finder(IQuery $query = null, $single = false, IContainer $container = null) |
| 104 | 104 | { |
| 105 | 105 | $query = ($query instanceof Query) ? $query : new Query($container->db); |
| 106 | - $query->table = static::tableName() . ' `m`'; |
|
| 106 | + $query->table = static::tableName().' `m`'; |
|
| 107 | 107 | $query->objectName = get_called_class(); |
| 108 | 108 | $query->single = $single; |
| 109 | 109 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | if (empty($this->cacheRelations[$name])) { |
| 159 | 159 | $sql = new Query($this->container->db); |
| 160 | 160 | |
| 161 | - $sql->addWhere('`m`.`' . $relation['On'][1] . '`=:' . $relation['On'][0]); |
|
| 161 | + $sql->addWhere('`m`.`'.$relation['On'][1].'`=:'.$relation['On'][0]); |
|
| 162 | 162 | |
| 163 | 163 | if ($relation['Where']) { |
| 164 | 164 | $sql->addWhere($relation['Where']); |
@@ -368,10 +368,10 @@ discard block |
||
| 368 | 368 | if ($this->beforeUpdate()) { |
| 369 | 369 | if (!$where) { |
| 370 | 370 | if (self::$primaryKey) { |
| 371 | - $where .= '`' . self::$primaryKey . '` = :' . self::$primaryKey; |
|
| 371 | + $where .= '`'.self::$primaryKey.'` = :'.self::$primaryKey; |
|
| 372 | 372 | } else { |
| 373 | 373 | throw new Exception($this->container, |
| 374 | - 'In table ' . static::tableName() . ' option `id` not defined/not use.' |
|
| 374 | + 'In table '.static::tableName().' option `id` not defined/not use.' |
|
| 375 | 375 | ); |
| 376 | 376 | } |
| 377 | 377 | } |
@@ -415,13 +415,13 @@ discard block |
||
| 415 | 415 | } |
| 416 | 416 | if ($this->beforeDelete()) { |
| 417 | 417 | if (!self::$primaryKey) { |
| 418 | - throw new Exception('In table ' . static::tableName() . ' option `id` not defined/not use.'); |
|
| 418 | + throw new Exception('In table '.static::tableName().' option `id` not defined/not use.'); |
|
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | if ( |
| 422 | 422 | $this->container->db->delete( |
| 423 | 423 | static::tableName(), |
| 424 | - self::$primaryKey . '=:' . self::$primaryKey, [self::$primaryKey => $this->{self::$primaryKey}] |
|
| 424 | + self::$primaryKey.'=:'.self::$primaryKey, [self::$primaryKey => $this->{self::$primaryKey}] |
|
| 425 | 425 | ) |
| 426 | 426 | ) { |
| 427 | 427 | $this->afterDelete(); |