@@ -33,7 +33,7 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | public function getHelp() |
| 35 | 35 | { |
| 36 | - return self::$banner . parent::getHelp(); |
|
| 36 | + return self::$banner.parent::getHelp(); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | ); |
| 208 | 208 | foreach ($iterator as $file) { |
| 209 | 209 | if ($file->isFile()) { |
| 210 | - if (preg_match('/' . $pattern . '/i', $file->getBasename())) { |
|
| 210 | + if (preg_match('/'.$pattern.'/i', $file->getBasename())) { |
|
| 211 | 211 | Util\File::getFS()->remove($file->getPathname()); |
| 212 | 212 | $fileCount++; |
| 213 | 213 | $this->builder->getLogger()->debug(\sprintf('Cache file "%s" removed', $file->getPathname())); |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | try { |
| 240 | 240 | $keyAsArray = explode('__', $this->prepareKey($key), -1); |
| 241 | 241 | if (!empty($keyAsArray)) { |
| 242 | - $pattern = Util::joinFile($this->cacheDir, $keyAsArray[0]) . '*'; |
|
| 242 | + $pattern = Util::joinFile($this->cacheDir, $keyAsArray[0]).'*'; |
|
| 243 | 243 | foreach (glob($pattern) as $filename) { |
| 244 | 244 | Util\File::getFS()->remove($filename); |
| 245 | 245 | } |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | // handles options |
| 63 | 63 | $canonical = null; // if true, add prefix URL with baseurl |
| 64 | - $format = null; // set output format |
|
| 65 | - $language = null; // force language |
|
| 64 | + $format = null; // set output format |
|
| 65 | + $language = null; // force language |
|
| 66 | 66 | extract(is_array($options) ? $options : [], EXTR_IF_EXISTS); |
| 67 | 67 | |
| 68 | 68 | // canonical URL? |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | // value is empty (i.e.: `url()`) |
| 78 | 78 | if (is_null($value) || empty($value) || $value == '/') { |
| 79 | - $this->url = $base . '/'; |
|
| 79 | + $this->url = $base.'/'; |
|
| 80 | 80 | |
| 81 | 81 | return; |
| 82 | 82 | } |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | $format = 'html'; // 'html' format by default |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | - $this->url = $base . '/' . ltrim((new PageRenderer($this->config))->getUrl($value, $format), '/'); |
|
| 95 | + $this->url = $base.'/'.ltrim((new PageRenderer($this->config))->getUrl($value, $format), '/'); |
|
| 96 | 96 | break; |
| 97 | 97 | case $value instanceof Asset: |
| 98 | - $this->url = $base . '/' . ltrim($value['path'], '/'); |
|
| 98 | + $this->url = $base.'/'.ltrim($value['path'], '/'); |
|
| 99 | 99 | break; |
| 100 | 100 | case is_string($value): |
| 101 | 101 | // potential Page ID |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | ); |
| 119 | 119 | break; |
| 120 | 120 | default: |
| 121 | - $this->url = $base . '/' . $lang . ltrim($value, '/'); |
|
| 121 | + $this->url = $base.'/'.$lang.ltrim($value, '/'); |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $format = 'webp'; |
| 63 | 63 | $image = ImageManager::make($assetWebp['content']); |
| 64 | 64 | $assetWebp['content'] = (string) $image->encode($format, $quality); |
| 65 | - $assetWebp['path'] = preg_replace('/\.' . $asset['ext'] . '$/m', ".$format", $asset['path']); |
|
| 65 | + $assetWebp['path'] = preg_replace('/\.'.$asset['ext'].'$/m', ".$format", $asset['path']); |
|
| 66 | 66 | $assetWebp['ext'] = $format; |
| 67 | 67 | |
| 68 | 68 | return $assetWebp; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $classArray = explode(' ', $class); |
| 111 | 111 | foreach ($classArray as $class) { |
| 112 | 112 | if (array_key_exists($class, $config)) { |
| 113 | - $result = $config[$class] . ', '; |
|
| 113 | + $result = $config[$class].', '; |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | if (!empty($result)) { |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $this->builder = $builder; |
| 66 | 66 | $this->config = $builder->getConfig(); |
| 67 | 67 | $paths = is_array($paths) ? $paths : [$paths]; |
| 68 | - array_walk($paths, function ($path) { |
|
| 68 | + array_walk($paths, function($path) { |
|
| 69 | 69 | if (empty($path)) { |
| 70 | 70 | throw new RuntimeException('The path to an asset can\'t be empty.'); |
| 71 | 71 | } |
@@ -74,20 +74,20 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | }); |
| 76 | 76 | $this->data = [ |
| 77 | - 'file' => '', // absolute file path |
|
| 78 | - 'files' => [], // bundle: files path |
|
| 79 | - 'filename' => '', // filename |
|
| 80 | - 'path_source' => '', // public path to the file, before transformations |
|
| 81 | - 'path' => '', // public path to the file, after transformations |
|
| 77 | + 'file' => '', // absolute file path |
|
| 78 | + 'files' => [], // bundle: files path |
|
| 79 | + 'filename' => '', // filename |
|
| 80 | + 'path_source' => '', // public path to the file, before transformations |
|
| 81 | + 'path' => '', // public path to the file, after transformations |
|
| 82 | 82 | 'missing' => false, // if file not found, but missing ollowed 'missing' is true |
| 83 | - 'ext' => '', // file extension |
|
| 84 | - 'type' => '', // file type (e.g.: image, audio, video, etc.) |
|
| 85 | - 'subtype' => '', // file media type (e.g.: image/png, audio/mp3, etc.) |
|
| 86 | - 'size' => 0, // file size (in bytes) |
|
| 87 | - 'content_source' => '', // file content, before transformations |
|
| 88 | - 'content' => '', // file content, after transformations |
|
| 89 | - 'width' => 0, // width (in pixels) in case of an image |
|
| 90 | - 'height' => 0, // height (in pixels) in case of an image |
|
| 83 | + 'ext' => '', // file extension |
|
| 84 | + 'type' => '', // file type (e.g.: image, audio, video, etc.) |
|
| 85 | + 'subtype' => '', // file media type (e.g.: image/png, audio/mp3, etc.) |
|
| 86 | + 'size' => 0, // file size (in bytes) |
|
| 87 | + 'content_source' => '', // file content, before transformations |
|
| 88 | + 'content' => '', // file content, after transformations |
|
| 89 | + 'width' => 0, // width (in pixels) in case of an image |
|
| 90 | + 'height' => 0, // height (in pixels) in case of an image |
|
| 91 | 91 | ]; |
| 92 | 92 | |
| 93 | 93 | // handles options |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $this->data['path_source'] = $file[$i]['path']; |
| 137 | 137 | $this->data['path'] = $file[$i]['path']; |
| 138 | 138 | if (!empty($filename)) { /** @phpstan-ignore-line */ |
| 139 | - $this->data['path'] = '/' . ltrim($filename, '/'); |
|
| 139 | + $this->data['path'] = '/'.ltrim($filename, '/'); |
|
| 140 | 140 | } |
| 141 | 141 | $this->data['ext'] = $file[$i]['ext']; |
| 142 | 142 | $this->data['type'] = $file[$i]['type']; |
@@ -154,10 +154,10 @@ discard block |
||
| 154 | 154 | switch ($this->data['ext']) { |
| 155 | 155 | case 'scss': |
| 156 | 156 | case 'css': |
| 157 | - $this->data['path'] = '/styles.' . $file[0]['ext']; |
|
| 157 | + $this->data['path'] = '/styles.'.$file[0]['ext']; |
|
| 158 | 158 | break; |
| 159 | 159 | case 'js': |
| 160 | - $this->data['path'] = '/scripts.' . $file[0]['ext']; |
|
| 160 | + $this->data['path'] = '/scripts.'.$file[0]['ext']; |
|
| 161 | 161 | break; |
| 162 | 162 | default: |
| 163 | 163 | throw new RuntimeException(\sprintf('Asset bundle supports "%s" files only.', '.scss, .css and .js')); |
@@ -216,8 +216,8 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | $fingerprint = hash('md5', $this->data['content_source']); |
| 218 | 218 | $this->data['path'] = preg_replace( |
| 219 | - '/\.' . $this->data['ext'] . '$/m', |
|
| 220 | - ".$fingerprint." . $this->data['ext'], |
|
| 219 | + '/\.'.$this->data['ext'].'$/m', |
|
| 220 | + ".$fingerprint.".$this->data['ext'], |
|
| 221 | 221 | $this->data['path'] |
| 222 | 222 | ); |
| 223 | 223 | |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | if ($this->builder->isDebug() && (bool) $this->config->get('assets.compile.sourcemap')) { |
| 265 | 265 | $importDir = []; |
| 266 | 266 | $assetDir = (string) $this->config->get('assets.dir'); |
| 267 | - $assetDirPos = strrpos($this->data['file'], DIRECTORY_SEPARATOR . $assetDir . DIRECTORY_SEPARATOR); |
|
| 267 | + $assetDirPos = strrpos($this->data['file'], DIRECTORY_SEPARATOR.$assetDir.DIRECTORY_SEPARATOR); |
|
| 268 | 268 | $fileRelPath = substr($this->data['file'], $assetDirPos + 8); |
| 269 | 269 | $filePath = Util::joinFile($this->config->getOutputPath(), $fileRelPath); |
| 270 | 270 | $importDir[] = dirname($filePath); |
@@ -347,8 +347,8 @@ discard block |
||
| 347 | 347 | throw new RuntimeException(\sprintf('Not able to minify "%s"', $this->data['path'])); |
| 348 | 348 | } |
| 349 | 349 | $this->data['path'] = preg_replace( |
| 350 | - '/\.' . $this->data['ext'] . '$/m', |
|
| 351 | - '.min.' . $this->data['ext'], |
|
| 350 | + '/\.'.$this->data['ext'].'$/m', |
|
| 351 | + '.min.'.$this->data['ext'], |
|
| 352 | 352 | $this->data['path'] |
| 353 | 353 | ); |
| 354 | 354 | $this->data['content'] = $minifier->minify(); |
@@ -430,14 +430,14 @@ discard block |
||
| 430 | 430 | |
| 431 | 431 | try { |
| 432 | 432 | $img = ImageManager::make($assetResized->data['content_source']); |
| 433 | - $img->resize($width, null, function (\Intervention\Image\Constraint $constraint) { |
|
| 433 | + $img->resize($width, null, function(\Intervention\Image\Constraint $constraint) { |
|
| 434 | 434 | $constraint->aspectRatio(); |
| 435 | 435 | $constraint->upsize(); |
| 436 | 436 | }); |
| 437 | 437 | } catch (\Exception $e) { |
| 438 | 438 | throw new RuntimeException(\sprintf('Not able to resize image "%s": %s', $assetResized->data['path'], $e->getMessage())); |
| 439 | 439 | } |
| 440 | - $assetResized->data['path'] = '/' . Util::joinPath( |
|
| 440 | + $assetResized->data['path'] = '/'.Util::joinPath( |
|
| 441 | 441 | (string) $this->config->get('assets.target'), |
| 442 | 442 | (string) $this->config->get('assets.images.resize.dir'), |
| 443 | 443 | (string) $width, |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | $force_slash = true; |
| 626 | 626 | } |
| 627 | 627 | if ($force_slash) { |
| 628 | - $path = '/' . ltrim($path, '/'); |
|
| 628 | + $path = '/'.ltrim($path, '/'); |
|
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | list($type, $subtype) = Util\File::getMimeType($filePath); |
@@ -93,9 +93,9 @@ |
||
| 93 | 93 | } elseif ($val instanceof \DateTimeInterface) { |
| 94 | 94 | $replacements["{{$key}}"] = $val->format(\DateTime::RFC3339); |
| 95 | 95 | } elseif (\is_object($val)) { |
| 96 | - $replacements["{{$key}}"] = '[object ' . \get_class($val) . ']'; |
|
| 96 | + $replacements["{{$key}}"] = '[object '.\get_class($val).']'; |
|
| 97 | 97 | } else { |
| 98 | - $replacements["{{$key}}"] = '[' . \gettype($val) . ']'; |
|
| 98 | + $replacements["{{$key}}"] = '['.\gettype($val).']'; |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
@@ -71,13 +71,13 @@ |
||
| 71 | 71 | foreach ($array as $key => $val) { |
| 72 | 72 | switch (gettype($val)) { |
| 73 | 73 | case 'array': |
| 74 | - $output .= str_repeat(' ', $column) . "$key:\n" . $this->printArray($val, $column); |
|
| 74 | + $output .= str_repeat(' ', $column)."$key:\n".$this->printArray($val, $column); |
|
| 75 | 75 | break; |
| 76 | 76 | case 'boolean': |
| 77 | - $output .= str_repeat(' ', $column) . "$key: " . ($val ? 'true' : 'false') . "\n"; |
|
| 77 | + $output .= str_repeat(' ', $column)."$key: ".($val ? 'true' : 'false')."\n"; |
|
| 78 | 78 | break; |
| 79 | 79 | default: |
| 80 | - $output .= str_repeat(' ', $column) . "$key: $val\n"; |
|
| 80 | + $output .= str_repeat(' ', $column)."$key: $val\n"; |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $php, |
| 88 | 88 | $host, |
| 89 | 89 | $port, |
| 90 | - $this->getPath() . '/' . (string) $this->getBuilder()->getConfig()->get('output.dir'), |
|
| 90 | + $this->getPath().'/'.(string) $this->getBuilder()->getConfig()->get('output.dir'), |
|
| 91 | 91 | Util::joinFile($this->getPath(), self::TMP_DIR, 'router.php') |
| 92 | 92 | ); |
| 93 | 93 | $process = Process::fromShellCommandline($command); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $buildProcessArguments[] = $clearcache; |
| 120 | 120 | } |
| 121 | 121 | if ($verbose) { |
| 122 | - $buildProcessArguments[] = '-' . str_repeat('v', $_SERVER['SHELL_VERBOSITY']); |
|
| 122 | + $buildProcessArguments[] = '-'.str_repeat('v', $_SERVER['SHELL_VERBOSITY']); |
|
| 123 | 123 | } |
| 124 | 124 | if (!empty($page)) { |
| 125 | 125 | $buildProcessArguments[] = '--page'; |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $buildProcess->setPty(Process::isPtySupported()); |
| 137 | 137 | $buildProcess->setTimeout(3600 * 2); // timeout = 2 minutes |
| 138 | 138 | |
| 139 | - $processOutputCallback = function ($type, $data) use ($output) { |
|
| 139 | + $processOutputCallback = function($type, $data) use ($output) { |
|
| 140 | 140 | $output->write($data, false, OutputInterface::OUTPUT_RAW); |
| 141 | 141 | }; |
| 142 | 142 | |
@@ -213,17 +213,17 @@ discard block |
||
| 213 | 213 | try { |
| 214 | 214 | $root = Util::joinFile(__DIR__, '../../'); |
| 215 | 215 | if (Util\Plateform::isPhar()) { |
| 216 | - $root = Util\Plateform::getPharPath() . '/'; |
|
| 216 | + $root = Util\Plateform::getPharPath().'/'; |
|
| 217 | 217 | } |
| 218 | 218 | // copying router |
| 219 | 219 | Util\File::getFS()->copy( |
| 220 | - $root . '/resources/server/router.php', |
|
| 220 | + $root.'/resources/server/router.php', |
|
| 221 | 221 | Util::joinFile($this->getPath(), self::TMP_DIR, 'router.php'), |
| 222 | 222 | true |
| 223 | 223 | ); |
| 224 | 224 | // copying livereload JS |
| 225 | 225 | Util\File::getFS()->copy( |
| 226 | - $root . '/resources/server/livereload.js', |
|
| 226 | + $root.'/resources/server/livereload.js', |
|
| 227 | 227 | Util::joinFile($this->getPath(), self::TMP_DIR, 'livereload.js'), |
| 228 | 228 | true |
| 229 | 229 | ); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | '%s%s%s%s%s', |
| 84 | 84 | (string) $this->getBuilder()->getConfig()->get('pages.dir'), |
| 85 | 85 | DIRECTORY_SEPARATOR, |
| 86 | - empty($dirname) ? '' : $dirname . DIRECTORY_SEPARATOR, |
|
| 86 | + empty($dirname) ? '' : $dirname.DIRECTORY_SEPARATOR, |
|
| 87 | 87 | $datePrefix, |
| 88 | 88 | $filename |
| 89 | 89 | ); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | // creates a new file |
| 107 | - $model = $this->findModel(\sprintf('%s%s', empty($dirname) ? '' : $dirname . DIRECTORY_SEPARATOR, $filename)); |
|
| 107 | + $model = $this->findModel(\sprintf('%s%s', empty($dirname) ? '' : $dirname.DIRECTORY_SEPARATOR, $filename)); |
|
| 108 | 108 | $fileContent = str_replace( |
| 109 | 109 | ['%title%', '%date%'], |
| 110 | 110 | [$title, $date], |