@@ -60,7 +60,7 @@ |
||
| 60 | 60 | /** |
| 61 | 61 | * {@inheritdoc} |
| 62 | 62 | */ |
| 63 | - public function log($level, string|\Stringable $message, array $context = []): void |
|
| 63 | + public function log($level, string | \Stringable $message, array $context = []): void |
|
| 64 | 64 | { |
| 65 | 65 | $output = $this->output; |
| 66 | 66 | $output->getFormatter()->setStyle('text', new OutputFormatterStyle('white')); |
@@ -184,7 +184,7 @@ |
||
| 184 | 184 | /** |
| 185 | 185 | * Returns the property value(s) of an output format. |
| 186 | 186 | */ |
| 187 | - public function getOutputProperty(string $name, string $property): string|array|null |
|
| 187 | + public function getOutputProperty(string $name, string $property): string | array | null |
|
| 188 | 188 | { |
| 189 | 189 | return $this->config->getOutputFormatProperty($name, $property); |
| 190 | 190 | } |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | /** |
| 47 | 47 | * {@inheritdoc} |
| 48 | 48 | */ |
| 49 | - public function log($level, string|\Stringable $message, array $context = []): void |
|
| 49 | + public function log($level, string | \Stringable $message, array $context = []): void |
|
| 50 | 50 | { |
| 51 | 51 | if (!isset($this->verbosityLevelMap[$level])) { |
| 52 | 52 | throw new InvalidArgumentException(\sprintf('The log level "%s" does not exist.', $level)); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $this->data->import($config, $mode); |
| 69 | 69 | $this->setFromEnv(); // override configuration with environment variables |
| 70 | - $this->validate(); // validate configuration |
|
| 70 | + $this->validate(); // validate configuration |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | * |
| 386 | 386 | * @throws ConfigException |
| 387 | 387 | */ |
| 388 | - public function getOutputFormatProperty(string $name, string $property): string|array|null |
|
| 388 | + public function getOutputFormatProperty(string $name, string $property): string | array | null |
|
| 389 | 389 | { |
| 390 | 390 | $properties = array_column((array) $this->get('output.formats'), $property, 'name'); |
| 391 | 391 | if (empty($properties)) { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * reverse => false|true |
| 64 | 64 | * ] |
| 65 | 65 | */ |
| 66 | - public function sortBy(string|array|null $options): self |
|
| 66 | + public function sortBy(string | array | null $options): self |
|
| 67 | 67 | { |
| 68 | 68 | $sortBy = \is_string($options) ? $options : $options['variable'] ?? 'date'; |
| 69 | 69 | $sortMethod = \sprintf('sortBy%s', ucfirst(str_replace('updated', 'date', $sortBy))); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | /** |
| 78 | 78 | * Sorts pages by date (or 'updated'): the most recent first. |
| 79 | 79 | */ |
| 80 | - public function sortByDate(string|array|null $options = null): self |
|
| 80 | + public function sortByDate(string | array | null $options = null): self |
|
| 81 | 81 | { |
| 82 | 82 | $opt = []; |
| 83 | 83 | // backward compatibility (i.e. $options = 'updated') |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | /** |
| 112 | 112 | * Sorts pages by title (natural sort). |
| 113 | 113 | */ |
| 114 | - public function sortByTitle(string|array|null $options = null): self |
|
| 114 | + public function sortByTitle(string | array | null $options = null): self |
|
| 115 | 115 | { |
| 116 | 116 | $opt = []; |
| 117 | 117 | // options |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | /** |
| 126 | 126 | * Sorts by weight (the heaviest first). |
| 127 | 127 | */ |
| 128 | - public function sortByWeight(string|array|null $options = null): self |
|
| 128 | + public function sortByWeight(string | array | null $options = null): self |
|
| 129 | 129 | { |
| 130 | 130 | $opt = []; |
| 131 | 131 | // options |
@@ -304,7 +304,7 @@ |
||
| 304 | 304 | /** |
| 305 | 305 | * Set configuration. |
| 306 | 306 | */ |
| 307 | - public function setConfig(array|Config $config): self |
|
| 307 | + public function setConfig(array | Config $config): self |
|
| 308 | 308 | { |
| 309 | 309 | if (\is_array($config)) { |
| 310 | 310 | $config = new Config($config); |
@@ -58,8 +58,8 @@ |
||
| 58 | 58 | |
| 59 | 59 | // handles options |
| 60 | 60 | $canonical = null; // if true prefix url with baseurl config |
| 61 | - $format = null; // output format |
|
| 62 | - $language = null; // force language |
|
| 61 | + $format = null; // output format |
|
| 62 | + $language = null; // force language |
|
| 63 | 63 | extract(\is_array($options) ? $options : [], EXTR_IF_EXISTS); |
| 64 | 64 | |
| 65 | 65 | // base URL |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @throws RuntimeException |
| 64 | 64 | */ |
| 65 | - public function __construct(Builder $builder, string|array $paths, array|null $options = null) |
|
| 65 | + public function __construct(Builder $builder, string | array $paths, array | null $options = null) |
|
| 66 | 66 | { |
| 67 | 67 | $this->builder = $builder; |
| 68 | 68 | $this->config = $builder->getConfig(); |
@@ -83,21 +83,21 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | }); |
| 85 | 85 | $this->data = [ |
| 86 | - 'file' => '', // absolute file path |
|
| 87 | - 'files' => [], // array of absolute files path |
|
| 86 | + 'file' => '', // absolute file path |
|
| 87 | + 'files' => [], // array of absolute files path |
|
| 88 | 88 | 'missing' => false, // if file not found but missing allowed: 'missing' is true |
| 89 | - '_path' => '', // original path |
|
| 90 | - 'path' => '', // public path |
|
| 91 | - 'url' => null, // URL if it's a remote file |
|
| 92 | - 'ext' => '', // file extension |
|
| 93 | - 'type' => '', // file type (e.g.: image, audio, video, etc.) |
|
| 94 | - 'subtype' => '', // file media type (e.g.: image/png, audio/mp3, etc.) |
|
| 95 | - 'size' => 0, // file size (in bytes) |
|
| 96 | - 'width' => 0, // image width (in pixels) |
|
| 97 | - 'height' => 0, // image height (in pixels) |
|
| 98 | - 'exif' => [], // image exif data |
|
| 99 | - 'content' => '', // file content |
|
| 100 | - 'hash' => '', // file content hash (md5) |
|
| 89 | + '_path' => '', // original path |
|
| 90 | + 'path' => '', // public path |
|
| 91 | + 'url' => null, // URL if it's a remote file |
|
| 92 | + 'ext' => '', // file extension |
|
| 93 | + 'type' => '', // file type (e.g.: image, audio, video, etc.) |
|
| 94 | + 'subtype' => '', // file media type (e.g.: image/png, audio/mp3, etc.) |
|
| 95 | + 'size' => 0, // file size (in bytes) |
|
| 96 | + 'width' => 0, // image width (in pixels) |
|
| 97 | + 'height' => 0, // image height (in pixels) |
|
| 98 | + 'exif' => [], // image exif data |
|
| 99 | + 'content' => '', // file content |
|
| 100 | + 'hash' => '', // file content hash (md5) |
|
| 101 | 101 | ]; |
| 102 | 102 | |
| 103 | 103 | // handles options |
@@ -289,10 +289,10 @@ discard block |
||
| 289 | 289 | public static function sanitizeKey(string $key): string |
| 290 | 290 | { |
| 291 | 291 | $key = str_replace(['https://', 'http://'], '', $key); // remove protocol (if URL) |
| 292 | - $key = Page::slugify($key); // slugify |
|
| 293 | - $key = trim($key, '/'); // remove leading/trailing slashes |
|
| 294 | - $key = str_replace(['\\', '/'], ['-', '-'], $key); // replace slashes by hyphens |
|
| 295 | - $key = substr($key, 0, 200); // truncate to 200 characters (NTFS filename length limit is 255 characters) |
|
| 292 | + $key = Page::slugify($key); // slugify |
|
| 293 | + $key = trim($key, '/'); // remove leading/trailing slashes |
|
| 294 | + $key = str_replace(['\\', '/'], ['-', '-'], $key); // replace slashes by hyphens |
|
| 295 | + $key = substr($key, 0, 200); // truncate to 200 characters (NTFS filename length limit is 255 characters) |
|
| 296 | 296 | |
| 297 | 297 | return $key; |
| 298 | 298 | } |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | /** |
| 326 | 326 | * Convert the various expressions of a TTL value into duration in seconds. |
| 327 | 327 | */ |
| 328 | - protected function duration(int|\DateInterval $ttl): int |
|
| 328 | + protected function duration(int | \DateInterval $ttl): int |
|
| 329 | 329 | { |
| 330 | 330 | if (\is_int($ttl)) { |
| 331 | 331 | return $ttl; |