| @@ -11,5 +11,5 @@ | ||
| 11 | 11 | |
| 12 | 12 | error_reporting(E_ALL & ~E_NOTICE); | 
| 13 | 13 | |
| 14 | -require_once __DIR__ . '/../vendor/autoload.php'; | |
| 15 | -require_once __DIR__ . '/../vendor/yiisoft/yii2/Yii.php'; | |
| 14 | +require_once __DIR__.'/../vendor/autoload.php'; | |
| 15 | +require_once __DIR__.'/../vendor/yiisoft/yii2/Yii.php'; | |
| @@ -109,6 +109,10 @@ | ||
| 109 | 109 | return $this->createRequest($query); | 
| 110 | 110 | } | 
| 111 | 111 | |
| 112 | + /** | |
| 113 | + * @param string $action | |
| 114 | + * @param string $table | |
| 115 | + */ | |
| 112 | 116 | public function perform($action, $table, $body, $options = []) | 
| 113 | 117 |      { | 
| 114 | 118 | $query = $this->createQuery($action, $table, $options)->body($body); | 
| @@ -154,7 +154,7 @@ discard block | ||
| 154 | 154 | |
| 155 | 155 | return $this->$method($operator, $condition); | 
| 156 | 156 |              } else { | 
| 157 | -                throw new InvalidParamException('Found unknown operator in query: ' . $operator); | |
| 157 | +                throw new InvalidParamException('Found unknown operator in query: '.$operator); | |
| 158 | 158 | } | 
| 159 | 159 |          } else { | 
| 160 | 160 | return $this->buildHashCondition($condition); | 
| @@ -167,7 +167,7 @@ discard block | ||
| 167 | 167 |          foreach ($condition as $attribute => $value) { | 
| 168 | 168 |              if (is_array($value)) { // IN condition | 
| 169 | 169 |                  // $parts[] = [$attribute.'s' => join(',',$value)]; | 
| 170 | -                $parts[$attribute . 's'] = implode(',', $value); | |
| 170 | +                $parts[$attribute.'s'] = implode(',', $value); | |
| 171 | 171 |              } else { | 
| 172 | 172 | $parts[$attribute] = $value; | 
| 173 | 173 | } | 
| @@ -178,12 +178,12 @@ discard block | ||
| 178 | 178 | |
| 179 | 179 | protected function buildLikeCondition($operator, $operands) | 
| 180 | 180 |      { | 
| 181 | - return [$operands[0] . '_like' => $operands[1]]; | |
| 181 | + return [$operands[0].'_like' => $operands[1]]; | |
| 182 | 182 | } | 
| 183 | 183 | |
| 184 | 184 | protected function buildIlikeCondition($operator, $operands) | 
| 185 | 185 |      { | 
| 186 | - return [$operands[0] . '_ilike' => $operands[1]]; | |
| 186 | + return [$operands[0].'_ilike' => $operands[1]]; | |
| 187 | 187 | } | 
| 188 | 188 | |
| 189 | 189 | protected function buildCompareCondition($operator, $operands) | 
| @@ -192,7 +192,7 @@ discard block | ||
| 192 | 192 |              throw new InvalidParamException("Operator '$operator' requires three operands."); | 
| 193 | 193 | } | 
| 194 | 194 | |
| 195 | - return [$operands[0] . '_' . $operator => $operands[1]]; | |
| 195 | + return [$operands[0].'_'.$operator => $operands[1]]; | |
| 196 | 196 | } | 
| 197 | 197 | |
| 198 | 198 | protected function buildAndCondition($operator, $operands) | 
| @@ -239,9 +239,9 @@ discard block | ||
| 239 | 239 | } | 
| 240 | 240 | |
| 241 | 241 |          if ($not) { | 
| 242 | - $key = $column . '_ni'; // not in | |
| 242 | + $key = $column.'_ni'; // not in | |
| 243 | 243 |          } else { | 
| 244 | - $key = $column . '_in'; | |
| 244 | + $key = $column.'_in'; | |
| 245 | 245 | } | 
| 246 | 246 | return [$key => $values]; | 
| 247 | 247 | } | 
| @@ -262,7 +262,7 @@ discard block | ||
| 262 | 262 |      { | 
| 263 | 263 | $key = array_shift($operands); | 
| 264 | 264 | |
| 265 | - return [$key . '_' . $operator => reset($operands)]; | |
| 265 | + return [$key.'_'.$operator => reset($operands)]; | |
| 266 | 266 | } | 
| 267 | 267 | |
| 268 | 268 | protected function buildCompositeInCondition($operator, $columns, $values) | 
| @@ -130,6 +130,9 @@ | ||
| 130 | 130 | return $this->_viewPath; | 
| 131 | 131 | } | 
| 132 | 132 | |
| 133 | + /** | |
| 134 | + * @param string $file | |
| 135 | + */ | |
| 133 | 136 | public function render($file, $data) | 
| 134 | 137 |      { | 
| 135 | 138 | return Yii::$app->view->render($file, $data, $this); | 
| @@ -51,7 +51,7 @@ discard block | ||
| 51 | 51 |          return $this->render('summary', [ | 
| 52 | 52 | 'url' => $this->getUrl(), | 
| 53 | 53 | 'count' => count($timings), | 
| 54 | - 'total' => number_format($total * 1000) . ' ms', | |
| 54 | + 'total' => number_format($total * 1000).' ms', | |
| 55 | 55 | ]); | 
| 56 | 56 | } | 
| 57 | 57 | |
| @@ -125,7 +125,7 @@ discard block | ||
| 125 | 125 | public function getViewPath() | 
| 126 | 126 |      { | 
| 127 | 127 |          if ($this->_viewPath === null) { | 
| 128 | - $this->_viewPath = dirname(__DIR__) . '/views/debug'; | |
| 128 | + $this->_viewPath = dirname(__DIR__).'/views/debug'; | |
| 129 | 129 | } | 
| 130 | 130 | return $this->_viewPath; | 
| 131 | 131 | } | 
| @@ -133,6 +133,10 @@ | ||
| 133 | 133 | return $this; | 
| 134 | 134 | } | 
| 135 | 135 | |
| 136 | + /** | |
| 137 | + * @param string $name | |
| 138 | + * @param boolean $value | |
| 139 | + */ | |
| 136 | 140 | public function addOption($name, $value) | 
| 137 | 141 |      { | 
| 138 | 142 |          if (!isset($this->options[$name])) { | 
| @@ -192,7 +192,7 @@ | ||
| 192 | 192 | public static function index() | 
| 193 | 193 |      { | 
| 194 | 194 | // return Inflector::pluralize(Inflector::camel2id(StringHelper::basename(get_called_class()), '-')); | 
| 195 | - return mb_strtolower(StringHelper::basename(get_called_class()) . 's'); | |
| 195 | + return mb_strtolower(StringHelper::basename(get_called_class()).'s'); | |
| 196 | 196 | } | 
| 197 | 197 | |
| 198 | 198 | public static function joinIndex() | 
| @@ -127,7 +127,7 @@ discard block | ||
| 127 | 127 | * | 
| 128 | 128 | * @throws InvalidConfigException | 
| 129 | 129 | * | 
| 130 | - * @return string|callable|array | |
| 130 | + * @return string | |
| 131 | 131 | * | 
| 132 | 132 | * @author SilverFire | 
| 133 | 133 | */ | 
| @@ -315,6 +315,9 @@ discard block | ||
| 315 | 315 | return $result === false ? false : true; | 
| 316 | 316 | } | 
| 317 | 317 | |
| 318 | + /** | |
| 319 | + * @param string $defaultScenario | |
| 320 | + */ | |
| 318 | 321 | public function performScenario($defaultScenario, $data, array $options = []) | 
| 319 | 322 |      { | 
| 320 | 323 | $action = $this->getScenarioAction($defaultScenario); | 
| @@ -322,6 +325,9 @@ discard block | ||
| 322 | 325 | return static::perform($action, $data, $options); | 
| 323 | 326 | } | 
| 324 | 327 | |
| 328 | + /** | |
| 329 | + * @param string $action | |
| 330 | + */ | |
| 325 | 331 | public static function perform($action, $data, array $options = []) | 
| 326 | 332 |      { | 
| 327 | 333 | return static::getDb()->createCommand()->perform($action, static::from(), $data, $options); | 
| @@ -29,7 +29,7 @@ | ||
| 29 | 29 | ]), | 
| 30 | 30 | 'container' => [ | 
| 31 | 31 | 'singletons' => [ | 
| 32 | -            \hiqdev\hiart\ConnectionInterface::class => function () { | |
| 32 | +            \hiqdev\hiart\ConnectionInterface::class => function() { | |
| 33 | 33 | return Yii::$app->get(Yii::$app->params['hiart.dbname']); | 
| 34 | 34 | }, | 
| 35 | 35 | ], | 
| @@ -79,7 +79,7 @@ discard block | ||
| 79 | 79 | |
| 80 | 80 | public function createFullUri() | 
| 81 | 81 |      { | 
| 82 | - return ($this->isFullUri($this->uri) ? '' : $this->getDb()->getBaseUri()) . $this->uri; | |
| 82 | + return ($this->isFullUri($this->uri) ? '' : $this->getDb()->getBaseUri()).$this->uri; | |
| 83 | 83 | } | 
| 84 | 84 | |
| 85 | 85 | public function isFullUri($uri) | 
| @@ -162,7 +162,7 @@ discard block | ||
| 162 | 162 | $params = http_build_query($params, '', '&'); | 
| 163 | 163 | } | 
| 164 | 164 |          if (!empty($params)) { | 
| 165 | - $this->uri .= '?' . $params; | |
| 165 | + $this->uri .= '?'.$params; | |
| 166 | 166 | } | 
| 167 | 167 | } | 
| 168 | 168 | |
| @@ -87,6 +87,9 @@ | ||
| 87 | 87 | return ($this->isFullUri($this->uri) ? '' : $this->getDb()->getBaseUri()) . $this->uri; | 
| 88 | 88 | } | 
| 89 | 89 | |
| 90 | + /** | |
| 91 | + * @param string $uri | |
| 92 | + */ | |
| 90 | 93 | public function isFullUri($uri) | 
| 91 | 94 |      { | 
| 92 | 95 |          return preg_match('/^https?:\\/\\//i', $uri); | 
| @@ -89,7 +89,7 @@ discard block | ||
| 89 | 89 |          if (!empty($this->traces)) { | 
| 90 | 90 | $result .= Html::ul($this->traces, [ | 
| 91 | 91 | 'class' => 'trace', | 
| 92 | -                'item' => function ($trace) { | |
| 92 | +                'item' => function($trace) { | |
| 93 | 93 |                      return "<li>{$trace['file']}({$trace['line']})</li>"; | 
| 94 | 94 | }, | 
| 95 | 95 | ]); | 
| @@ -112,7 +112,7 @@ discard block | ||
| 112 | 112 |      { | 
| 113 | 113 | $uri = $this->request->getFullUri(); | 
| 114 | 114 | $sign = strpos($uri, '?') === false ? '?' : ''; | 
| 115 | - $newTabUrl = rtrim($uri, '&') . $sign . $this->request->getBody(); | |
| 115 | + $newTabUrl = rtrim($uri, '&').$sign.$this->request->getBody(); | |
| 116 | 116 | |
| 117 | 117 |          return Html::a('to new tab', $newTabUrl, ['target' => '_blank']); | 
| 118 | 118 | } | 
| @@ -24,10 +24,10 @@ | ||
| 24 | 24 |      { | 
| 25 | 25 | $auth = $this->db->getAuth(); | 
| 26 | 26 |          if (isset($auth['headerToken'])) { | 
| 27 | - $this->authHeaders['Authorization'] = 'token ' . $auth['headerToken']; | |
| 27 | + $this->authHeaders['Authorization'] = 'token '.$auth['headerToken']; | |
| 28 | 28 | } | 
| 29 | 29 |          if (isset($auth['headerBearer'])) { | 
| 30 | - $this->authHeaders['Authorization'] = 'Bearer ' . $auth['headerBearer']; | |
| 30 | + $this->authHeaders['Authorization'] = 'Bearer '.$auth['headerBearer']; | |
| 31 | 31 | } | 
| 32 | 32 | } | 
| 33 | 33 | |