@@ -53,7 +53,7 @@ |
||
| 53 | 53 | * ``` |
| 54 | 54 | * |
| 55 | 55 | * @param array $data The input data to cover given sensitive key values. `['username' => 'foo', 'password' => 'bar']`. |
| 56 | - * @param array $key The keys which can contain sensitive data inside the $data array. `['password', 'pwd', 'pass']` if no keys provided the {{luya\helpers\ArrayHelper::$sensitiveDefaultKeys}} is used. |
|
| 56 | + * @param array $keys The keys which can contain sensitive data inside the $data array. `['password', 'pwd', 'pass']` if no keys provided the {{luya\helpers\ArrayHelper::$sensitiveDefaultKeys}} is used. |
|
| 57 | 57 | * @since 1.0.6 |
| 58 | 58 | */ |
| 59 | 59 | public static function coverSensitiveValues(array $data, array $keys = []) |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | public static function search(array $array, $searchText, $sensitive = false, array $keys = []) |
| 159 | 159 | { |
| 160 | 160 | $function = $sensitive ? 'strpos' : 'stripos'; |
| 161 | - return array_filter($array, function ($item) use ($searchText, $function, $keys) { |
|
| 161 | + return array_filter($array, function($item) use ($searchText, $function, $keys) { |
|
| 162 | 162 | $response = false; |
| 163 | 163 | foreach ($item as $key => $value) { |
| 164 | 164 | if ($response) { |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $array = array_values($array); // align array keys |
| 207 | 207 | $columns = array_column($array, $column); |
| 208 | 208 | $key = array_search($search, $columns); |
| 209 | - return ($key !== false) ? $array[$key] : false; |
|
| 209 | + return ($key !== false) ? $array[$key] : false; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | public static function searchColumns(array $array, $column, $search) |
| 240 | 240 | { |
| 241 | - $keys = array_filter($array, function ($var) use ($column, $search) { |
|
| 241 | + $keys = array_filter($array, function($var) use ($column, $search) { |
|
| 242 | 242 | return strcasecmp($search, $var[$column]) == 0 ? true : false; |
| 243 | 243 | }); |
| 244 | 244 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | $array = array_combine($range, $range); |
| 279 | 279 | |
| 280 | 280 | if ($text) { |
| 281 | - array_walk($array, function (&$item, $key) use ($text) { |
|
| 281 | + array_walk($array, function(&$item, $key) use ($text) { |
|
| 282 | 282 | if (is_array($text)) { |
| 283 | 283 | list($singular, $plural) = $text; |
| 284 | 284 | if ($key == 1) { |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | |
| 89 | 89 | // generate the rules from apiRules defintions as they are own entries: |
| 90 | 90 | foreach ($rules as $api => $rule) { |
| 91 | - $rule['controller'] = 'admin/' . $api; |
|
| 91 | + $rule['controller'] = 'admin/'.$api; |
|
| 92 | 92 | $result[] = $rule; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -2,8 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace luya\web; |
| 4 | 4 | |
| 5 | -use Yii; |
|
| 6 | -use yii\base\InvalidConfigException; |
|
| 7 | 5 | use yii\helpers\ArrayHelper; |
| 8 | 6 | use luya\base\AdminModuleInterface; |
| 9 | 7 | use luya\TagParser; |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | - return [ |
|
| 2 | + return [ |
|
| 3 | 3 | '{attribute} must have a minimum length of {length} characters.' => '{attribute} musi mieć co najmniej {length} znaków.', |
| 4 | 4 | '{attribute} must include at least one special character.' => '{attribute} musi zawierać przynajmniej jeden znak specjalny.', |
| 5 | 5 | '{attribute} must include at least one digit.' => '{attribute} musi zawierać co najmniej jedną cyfrę.', |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $messageFiles = glob("$repoPath/src/**/messages/$language/$filename.php") ?: glob("$repoPath/src/messages/$language/$filename.php"); |
| 42 | 42 | |
| 43 | 43 | $this->outputInfo('Following files will be affected:'); |
| 44 | - $this->output(implode("\n", $messageFiles) . "\n"); |
|
| 44 | + $this->output(implode("\n", $messageFiles)."\n"); |
|
| 45 | 45 | |
| 46 | 46 | $key = $this->prompt('Insert translation key:'); |
| 47 | 47 | $text = $this->prompt('Insert translation text:'); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | if (!$this->dry) { |
| 61 | 61 | if (exec("[ -d $repoPath/.git ] && command -v git")) { |
| 62 | - $diffCommand = "git --git-dir=$repoPath/.git --work-tree=$repoPath diff -- " . str_replace($repoPath . '/', '', implode(" ", $messageFiles)); |
|
| 62 | + $diffCommand = "git --git-dir=$repoPath/.git --work-tree=$repoPath diff -- ".str_replace($repoPath.'/', '', implode(" ", $messageFiles)); |
|
| 63 | 63 | exec($diffCommand, $diff); |
| 64 | 64 | $this->output(implode("\n", $diff)); |
| 65 | 65 | } |
@@ -33,14 +33,14 @@ |
||
| 33 | 33 | { |
| 34 | 34 | if ($this->module instanceof Module) { |
| 35 | 35 | if ($this->module->useAppViewPath) { |
| 36 | - return '@app/views/' . $this->module->id . '/' . $this->id; |
|
| 36 | + return '@app/views/'.$this->module->id.'/'.$this->id; |
|
| 37 | 37 | } elseif (is_array($this->module->viewMap)) { |
| 38 | - $currentAction = $this->id . '/' . ($this->action ? $this->action->id : $this->defaultAction); |
|
| 38 | + $currentAction = $this->id.'/'.($this->action ? $this->action->id : $this->defaultAction); |
|
| 39 | 39 | foreach ($this->module->viewMap as $action => $viewPath) { |
| 40 | 40 | |
| 41 | 41 | // Special case for map all views of controller |
| 42 | 42 | if ($action === '*') { |
| 43 | - return $viewPath . '/' . $this->id; |
|
| 43 | + return $viewPath.'/'.$this->id; |
|
| 44 | 44 | } elseif (fnmatch($action, $currentAction)) { |
| 45 | 45 | return $viewPath; |
| 46 | 46 | } |
@@ -100,25 +100,25 @@ discard block |
||
| 100 | 100 | public function run() |
| 101 | 101 | { |
| 102 | 102 | // Cache generated code |
| 103 | - return $this->getOrSetHasCache(['svg', $this->folder, $this->file, $this->cssClass], function () { |
|
| 103 | + return $this->getOrSetHasCache(['svg', $this->folder, $this->file, $this->cssClass], function() { |
|
| 104 | 104 | |
| 105 | 105 | // Check if file ends with .svg, if not add the extension |
| 106 | - $svgFile = StringHelper::endsWith($this->file, '.svg') ? $this->file : $this->file . '.svg'; |
|
| 106 | + $svgFile = StringHelper::endsWith($this->file, '.svg') ? $this->file : $this->file.'.svg'; |
|
| 107 | 107 | |
| 108 | 108 | if ($this->symbolMode) { |
| 109 | - $svgPath = Yii::$app->view->publicHtml . '/' . $svgFile; |
|
| 109 | + $svgPath = Yii::$app->view->publicHtml.'/'.$svgFile; |
|
| 110 | 110 | |
| 111 | - return '<svg class="symbol symbol--' . $this->symbolName . '' . ($this->cssClass ? ' ' . $this->cssClass : '') . '"><use class="symbol__use" xlink:href="' . $svgPath . '#' . $this->symbolName . '" /></svg>'; |
|
| 111 | + return '<svg class="symbol symbol--'.$this->symbolName.''.($this->cssClass ? ' '.$this->cssClass : '').'"><use class="symbol__use" xlink:href="'.$svgPath.'#'.$this->symbolName.'" /></svg>'; |
|
| 112 | 112 | } else { |
| 113 | 113 | // Build the full svg file path |
| 114 | - $svgPath = $this->folder . DIRECTORY_SEPARATOR . $svgFile; |
|
| 114 | + $svgPath = $this->folder.DIRECTORY_SEPARATOR.$svgFile; |
|
| 115 | 115 | |
| 116 | 116 | // Get the svg contents |
| 117 | 117 | $content = FileHelper::getFileContent($svgPath); |
| 118 | 118 | |
| 119 | 119 | // If a cssClass string is given, add it to the <svg> tag |
| 120 | 120 | if ($this->cssClass && is_string($this->cssClass)) { |
| 121 | - $content = preg_replace('/<svg/', '<svg class="' . $this->cssClass . '"', $content); |
|
| 121 | + $content = preg_replace('/<svg/', '<svg class="'.$this->cssClass.'"', $content); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if ($content) { |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - throw new Exception('Unable to access SVG File: ' . $svgPath); |
|
| 129 | + throw new Exception('Unable to access SVG File: '.$svgPath); |
|
| 130 | 130 | }); |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -255,6 +255,6 @@ |
||
| 255 | 255 | { |
| 256 | 256 | $view = new View(); |
| 257 | 257 | $view->autoRegisterCsrf = false; |
| 258 | - return $view->renderPhpFile(rtrim($this->getFolder(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . FileHelper::ensureExtension($file, 'php'), $args); |
|
| 258 | + return $view->renderPhpFile(rtrim($this->getFolder(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.FileHelper::ensureExtension($file, 'php'), $args); |
|
| 259 | 259 | } |
| 260 | 260 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | return true; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - return ($value == (string)(float) $value); |
|
| 99 | + return ($value == (string) (float) $value); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | // we could not find any match, therefore use casual truncate method. |
| 206 | 206 | if ($first === false) { |
| 207 | 207 | // as the length value in truncate middle stands for to the left and to the right, we multiple this value with 2 |
| 208 | - return self::truncate($content, ($length*2), $affix); |
|
| 208 | + return self::truncate($content, ($length * 2), $affix); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | $last = $first + mb_strlen($word); |
@@ -217,9 +217,9 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | // string before |
| 219 | 219 | $before = (count($left) > $length) ? $affix.implode("", array_slice($left, -$length)) : implode("", $left); |
| 220 | - $after = (count($right) > $length) ? implode("", array_slice($right, 0, $length)) . $affix : implode("", $right); |
|
| 220 | + $after = (count($right) > $length) ? implode("", array_slice($right, 0, $length)).$affix : implode("", $right); |
|
| 221 | 221 | |
| 222 | - return $before . implode("", $middle) . $after; |
|
| 222 | + return $before.implode("", $middle).$after; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @param string $search Search string to look for. |
| 112 | 112 | * @param string $replace Replacement value for the first found occurrence. |
| 113 | 113 | * @param string $subject The string you want to look up to replace the first element. |
| 114 | - * @return mixed Replaced string |
|
| 114 | + * @return string Replaced string |
|
| 115 | 115 | */ |
| 116 | 116 | public static function replaceFirst($search, $replace, $subject) |
| 117 | 117 | { |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * } |
| 142 | 142 | * ``` |
| 143 | 143 | * |
| 144 | - * @param string|array $needle The char or word to find in the $haystack. Can be an array to multi find words or char in the string. |
|
| 144 | + * @param string $needle The char or word to find in the $haystack. Can be an array to multi find words or char in the string. |
|
| 145 | 145 | * @param string $haystack The haystack where the $needle string should be looked up. A string or phrase with words. |
| 146 | 146 | * @param boolean $strict If an array of needles is provided the $strict parameter defines whether all keys must be found ($strict = true) or just one result must be found ($strict = false). |
| 147 | 147 | * @return boolean If an array of values is provided the response may change depending on $findAll. |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * @param string $content The content to minify. |
| 179 | 179 | * @param array $options Optional arguments to provide for minification: |
| 180 | 180 | * - comments: boolean, where html comments should be removed or not. defaults to false |
| 181 | - * @return mixed Returns the minified content. |
|
| 181 | + * @return string Returns the minified content. |
|
| 182 | 182 | * @since 1.0.7 |
| 183 | 183 | */ |
| 184 | 184 | public static function minify($content, array $options = []) |
@@ -150,10 +150,10 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function run() |
| 152 | 152 | { |
| 153 | - $class = ($this->placeholderSrc ? 'lazyimage-wrapper' : 'lazy-image') . ' ' . $this->extraClass; |
|
| 153 | + $class = ($this->placeholderSrc ? 'lazyimage-wrapper' : 'lazy-image').' '.$this->extraClass; |
|
| 154 | 154 | |
| 155 | 155 | if ($this->placeholderSrc && $this->placeholderAsBase64) { |
| 156 | - $this->placeholderSrc = 'data:image/jpg;base64,' . base64_encode(file_get_contents($this->placeholderSrc)); |
|
| 156 | + $this->placeholderSrc = 'data:image/jpg;base64,'.base64_encode(file_get_contents($this->placeholderSrc)); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | if ($this->attributesOnly && !$this->placeholderSrc) { |
@@ -161,15 +161,15 @@ discard block |
||
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | if ($this->placeholderSrc) { |
| 164 | - $tag = '<div class="' . $class . '">'; |
|
| 164 | + $tag = '<div class="'.$class.'">'; |
|
| 165 | 165 | $tag .= Html::tag('img', '', ['class' => 'lazy-image lazyimage', 'data-src' => $this->src]); |
| 166 | 166 | $tag .= Html::tag('img', '', ['class' => 'lazyimage-placeholder-image', 'src' => $this->placeholderSrc]); |
| 167 | - $tag .= '<noscript><img class="lazyimage-image" src="' . $this->src . '" /></noscript>'; |
|
| 167 | + $tag .= '<noscript><img class="lazyimage-image" src="'.$this->src.'" /></noscript>'; |
|
| 168 | 168 | $tag .= '</div>'; |
| 169 | 169 | } else { |
| 170 | 170 | $tag = Html::tag('img', '', ['class' => $class, 'data-src' => $this->src, 'data-width' => $this->width, 'data-height' => $this->height]); |
| 171 | 171 | if ($this->width && $this->height) { |
| 172 | - $tag .= '<div class="lazy-placeholder ' . $class .'"><div style="display: block; height: 0px; padding-bottom: ' . ($this->height / $this->width) * 100 . '%;"></div><div class="loader"></div></div>'; |
|
| 172 | + $tag .= '<div class="lazy-placeholder '.$class.'"><div style="display: block; height: 0px; padding-bottom: '.($this->height / $this->width) * 100.'%;"></div><div class="loader"></div></div>'; |
|
| 173 | 173 | } |
| 174 | 174 | $tag .= '<noscript><img class="'.$class.'" src="'.$this->src.'" /></noscript>'; |
| 175 | 175 | } |