@@ -35,7 +35,7 @@ |
||
| 35 | 35 | $breakerPos = mb_strpos($text, '<br', null, 'UTF-8'); |
| 36 | 36 | } else { |
| 37 | 37 | // add length('</p>') |
| 38 | - $breakerPos+= 4; |
|
| 38 | + $breakerPos += 4; |
|
| 39 | 39 | } |
| 40 | 40 | // cut text from position caret before </p> (+4 symbols to save item as valid) |
| 41 | 41 | if ($breakerPos !== false) { |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $hints[] = '<code>LIMIT</code> without <code>ORDER BY</code> causes non-deterministic results, depending on the query execution plan'; |
| 161 | 161 | } |
| 162 | 162 | if (preg_match('/LIKE\\s[\'"](%.*?)[\'"]/i', $query, $matches)) { |
| 163 | - $hints[] = 'An argument has a leading wildcard character: <code>' . $matches[1] . '</code>. |
|
| 163 | + $hints[] = 'An argument has a leading wildcard character: <code>'.$matches[1].'</code>. |
|
| 164 | 164 | The predicate with this argument is not sargable and cannot use an index if one exists.'; |
| 165 | 165 | } |
| 166 | 166 | return implode("<br />", $hints); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | foreach ($traces as $trace) { |
| 176 | 176 | if (isset($trace['class']) && isset($trace['file']) && strpos( |
| 177 | 177 | $trace['file'], |
| 178 | - DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR |
|
| 178 | + DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR |
|
| 179 | 179 | ) === false |
| 180 | 180 | ) { |
| 181 | 181 | if (isset($trace['object']) && is_a($trace['object'], 'Twig_Template')) { |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $line = isset($trace['line']) ? $trace['line'] : '?'; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - return $this->normalizeFilename($file) . ':' . $line; |
|
| 190 | + return $this->normalizeFilename($file).':'.$line; |
|
| 191 | 191 | } elseif (isset($trace['function']) && $trace['function'] == 'Illuminate\Routing\{closure}') { |
| 192 | 192 | return 'Route binding'; |
| 193 | 193 | } |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | { |
| 56 | 56 | $path = self::diskPath($path); |
| 57 | 57 | if (!Str::startsWith(root, $path)) { |
| 58 | - $path = root . DIRECTORY_SEPARATOR . ltrim($path, '\\/'); |
|
| 58 | + $path = root.DIRECTORY_SEPARATOR.ltrim($path, '\\/'); |
|
| 59 | 59 | } |
| 60 | 60 | return $path; |
| 61 | 61 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | return false; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - $pattern = rtrim($path, '/') . '/*'; |
|
| 94 | + $pattern = rtrim($path, '/').'/*'; |
|
| 95 | 95 | $entry = glob($pattern, $mod); |
| 96 | 96 | |
| 97 | 97 | if ($returnRelative === true) { |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | array_pop($separatedPath); |
| 123 | 123 | $clearPath = implode(DIRECTORY_SEPARATOR, $separatedPath); |
| 124 | 124 | |
| 125 | - @rename($path, $clearPath . DIRECTORY_SEPARATOR . $newDirName); |
|
| 125 | + @rename($path, $clearPath.DIRECTORY_SEPARATOR.$newDirName); |
|
| 126 | 126 | |
| 127 | 127 | return true; |
| 128 | 128 | } |
@@ -118,16 +118,16 @@ |
||
| 118 | 118 | return 'true'; |
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | - return '\'' . $var . '\''; |
|
| 121 | + return '\''.$var.'\''; |
|
| 122 | 122 | case 'array': |
| 123 | 123 | $indexed = array_keys($var) === range(0, count($var) - 1); |
| 124 | 124 | $row = []; |
| 125 | 125 | foreach ($var as $key => $value) { |
| 126 | - $row[] = $indent . "\t" |
|
| 127 | - . ($indexed ? null : self::exportVar($key, null, $guessTypes) . ' => ') |
|
| 128 | - . self::exportVar($value, $indent . "\t", $guessTypes); |
|
| 126 | + $row[] = $indent."\t" |
|
| 127 | + . ($indexed ? null : self::exportVar($key, null, $guessTypes).' => ') |
|
| 128 | + . self::exportVar($value, $indent."\t", $guessTypes); |
|
| 129 | 129 | } |
| 130 | - return "[\n" . implode(",\n", $row) . "\n" . $indent . ']'; |
|
| 130 | + return "[\n".implode(",\n", $row)."\n".$indent.']'; |
|
| 131 | 131 | case 'boolean': |
| 132 | 132 | return $var ? 'true' : 'false'; |
| 133 | 133 | default: |
@@ -19,8 +19,9 @@ discard block |
||
| 19 | 19 | public static function in($needle, ?array $haystack = null, bool $strict = true): bool |
| 20 | 20 | { |
| 21 | 21 | // prevent errors |
| 22 | - if (!Any::isArray($haystack) || $needle === null) |
|
| 23 | - return false; |
|
| 22 | + if (!Any::isArray($haystack) || $needle === null) { |
|
| 23 | + return false; |
|
| 24 | + } |
|
| 24 | 25 | |
| 25 | 26 | return in_array($needle, $haystack, $strict); |
| 26 | 27 | } |
@@ -33,8 +34,9 @@ discard block |
||
| 33 | 34 | { |
| 34 | 35 | $arguments = []; |
| 35 | 36 | foreach (func_get_args() as $key => $val) { |
| 36 | - if (!Any::isArray($val)) |
|
| 37 | - $val = []; |
|
| 37 | + if (!Any::isArray($val)) { |
|
| 38 | + $val = []; |
|
| 39 | + } |
|
| 38 | 40 | |
| 39 | 41 | $arguments[$key] = $val; |
| 40 | 42 | } |
@@ -49,8 +51,9 @@ discard block |
||
| 49 | 51 | { |
| 50 | 52 | $arguments = []; |
| 51 | 53 | foreach (func_get_args() as $key => $val) { |
| 52 | - if (!Any::isArray($val)) |
|
| 53 | - $val = []; |
|
| 54 | + if (!Any::isArray($val)) { |
|
| 55 | + $val = []; |
|
| 56 | + } |
|
| 54 | 57 | |
| 55 | 58 | $arguments[$key] = $val; |
| 56 | 59 | } |
@@ -67,18 +70,21 @@ discard block |
||
| 67 | 70 | public static function getByPath(string $path, ?array $array = null, $delimiter = '.') |
| 68 | 71 | { |
| 69 | 72 | // path of nothing? interest |
| 70 | - if (!Any::isArray($array) || count($array) < 1 || !Any::isStr($path) || Str::likeEmpty($path)) |
|
| 71 | - return null; |
|
| 73 | + if (!Any::isArray($array) || count($array) < 1 || !Any::isStr($path) || Str::likeEmpty($path)) { |
|
| 74 | + return null; |
|
| 75 | + } |
|
| 72 | 76 | |
| 73 | 77 | // c'mon man, what the f*ck are you doing? )) |
| 74 | - if (!Str::contains($delimiter, $path)) |
|
| 75 | - return $array[$path]; |
|
| 78 | + if (!Str::contains($delimiter, $path)) { |
|
| 79 | + return $array[$path]; |
|
| 80 | + } |
|
| 76 | 81 | |
| 77 | 82 | $output = $array; |
| 78 | 83 | $pathArray = explode($delimiter, $path); |
| 79 | 84 | foreach ($pathArray as $key) { |
| 80 | - if (!Any::isArray($output) || !array_key_exists($key, $output)) |
|
| 81 | - return null; |
|
| 85 | + if (!Any::isArray($output) || !array_key_exists($key, $output)) { |
|
| 86 | + return null; |
|
| 87 | + } |
|
| 82 | 88 | |
| 83 | 89 | $output = $output[$key]; |
| 84 | 90 | } |
@@ -93,14 +99,16 @@ discard block |
||
| 93 | 99 | */ |
| 94 | 100 | public static function pluck(?string $key = null, ?array $array = null): array |
| 95 | 101 | { |
| 96 | - if (!Any::isArray($array) || !Any::isStr($key)) |
|
| 97 | - return []; |
|
| 102 | + if (!Any::isArray($array) || !Any::isStr($key)) { |
|
| 103 | + return []; |
|
| 104 | + } |
|
| 98 | 105 | |
| 99 | 106 | $output = []; |
| 100 | 107 | foreach ($array as $item) { |
| 101 | 108 | $object = $item[$key]; |
| 102 | - if (!self::in($object, $output)) |
|
| 103 | - $output[] = $object; |
|
| 109 | + if (!self::in($object, $output)) { |
|
| 110 | + $output[] = $object; |
|
| 111 | + } |
|
| 104 | 112 | } |
| 105 | 113 | return $output; |
| 106 | 114 | } |
@@ -148,8 +156,9 @@ discard block |
||
| 148 | 156 | */ |
| 149 | 157 | public static function onlyNumericValues(?array $array = null) |
| 150 | 158 | { |
| 151 | - if (!Any::isArray($array)) |
|
| 152 | - return false; |
|
| 159 | + if (!Any::isArray($array)) { |
|
| 160 | + return false; |
|
| 161 | + } |
|
| 153 | 162 | |
| 154 | 163 | return is_numeric(implode('', $array)); |
| 155 | 164 | } |
@@ -67,6 +67,6 @@ |
||
| 67 | 67 | return 'error'; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - return (int)$load . '%'; |
|
| 70 | + return (int)$load.'%'; |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | \ No newline at end of file |
@@ -22,10 +22,10 @@ |
||
| 22 | 22 | { |
| 23 | 23 | $to = trim($to, '/'); |
| 24 | 24 | if (false === $full && !Str::startsWith(App::$Alias->baseUrl, $to)) { |
| 25 | - $to = App::$Alias->baseUrl . '/' . $to; |
|
| 25 | + $to = App::$Alias->baseUrl.'/'.$to; |
|
| 26 | 26 | } |
| 27 | 27 | $redirect = new FoundationRedirect($to); |
| 28 | 28 | $redirect->send(); |
| 29 | - exit('Redirecting to ' . $to . ' ...'); |
|
| 29 | + exit('Redirecting to '.$to.' ...'); |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | \ No newline at end of file |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | // build error text |
| 63 | 63 | $rawResponse = 'error'; |
| 64 | 64 | try { |
| 65 | - $rawResponse = App::$View->render('native/errors/' . $this->tpl, ['msg' => $this->text]); |
|
| 65 | + $rawResponse = App::$View->render('native/errors/'.$this->tpl, ['msg' => $this->text]); |
|
| 66 | 66 | if (Str::likeEmpty($rawResponse)) { |
| 67 | 67 | $rawResponse = $this->text; |
| 68 | 68 | } |
@@ -36,8 +36,9 @@ |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // add notification in debug bar if exist |
| 39 | - if (App::$Debug !== null) |
|
| 40 | - App::$Debug->addException($this); |
|
| 39 | + if (App::$Debug !== null) { |
|
| 40 | + App::$Debug->addException($this); |
|
| 41 | + } |
|
| 41 | 42 | |
| 42 | 43 | // return rendered result |
| 43 | 44 | return $this->buildFakePage(); |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | protected function sendHTML($message = null) |
| 56 | 56 | { |
| 57 | 57 | header('HTTP/1.1 404 Not Found'); |
| 58 | - return '<!DOCTYPE html><html><head><title>An error has occurred</title></head><body><div style="width:60%; margin: auto; background-color: #fcc;border: 1px solid #faa; padding: 0.5em 1em;"><h1 style="font-size: 120%">Runtime error</h1><p>' . $message . '</p></div></body></html>'; |
|
| 58 | + return '<!DOCTYPE html><html><head><title>An error has occurred</title></head><body><div style="width:60%; margin: auto; background-color: #fcc;border: 1px solid #faa; padding: 0.5em 1em;"><h1 style="font-size: 120%">Runtime error</h1><p>'.$message.'</p></div></body></html>'; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |