@@ -114,24 +114,24 @@ |
||
| 114 | 114 | public static function firstLineOfTextFromHtml(string $html): string |
| 115 | 115 | { |
| 116 | 116 | $html = strtr($html, [ |
| 117 | - '</blockquote>' => MarkdownFactory::BREAK, |
|
| 118 | - '</h1>' => MarkdownFactory::BREAK, |
|
| 119 | - '</h2>' => MarkdownFactory::BREAK, |
|
| 120 | - '</h3>' => MarkdownFactory::BREAK, |
|
| 121 | - '</h4>' => MarkdownFactory::BREAK, |
|
| 122 | - '</h5>' => MarkdownFactory::BREAK, |
|
| 123 | - '</h6>' => MarkdownFactory::BREAK, |
|
| 124 | - '</li>' => MarkdownFactory::BREAK, |
|
| 125 | - '</p>' => MarkdownFactory::BREAK, |
|
| 126 | - '</pre>' => MarkdownFactory::BREAK, |
|
| 117 | + '</blockquote>' => MarkdownFactory::break, |
|
| 118 | + '</h1>' => MarkdownFactory::break, |
|
| 119 | + '</h2>' => MarkdownFactory::break, |
|
| 120 | + '</h3>' => MarkdownFactory::break, |
|
| 121 | + '</h4>' => MarkdownFactory::break, |
|
| 122 | + '</h5>' => MarkdownFactory::break, |
|
| 123 | + '</h6>' => MarkdownFactory::break, |
|
| 124 | + '</li>' => MarkdownFactory::break, |
|
| 125 | + '</p>' => MarkdownFactory::break, |
|
| 126 | + '</pre>' => MarkdownFactory::break, |
|
| 127 | 127 | '</td>' => ' ', |
| 128 | 128 | '</th>' => ' ', |
| 129 | - '<hr>' => MarkdownFactory::BREAK, |
|
| 129 | + '<hr>' => MarkdownFactory::break, |
|
| 130 | 130 | ]); |
| 131 | 131 | |
| 132 | 132 | $html = strip_tags($html, ['br']); |
| 133 | 133 | |
| 134 | - [$first] = explode(MarkdownFactory::BREAK, $html, 2); |
|
| 134 | + [$first] = explode(MarkdownFactory::break, $html, 2); |
|
| 135 | 135 | |
| 136 | 136 | return htmlspecialchars_decode($first, ENT_QUOTES); |
| 137 | 137 | } |
@@ -1090,7 +1090,7 @@ |
||
| 1090 | 1090 | } else { |
| 1091 | 1091 | $value = strip_tags(Registry::markdownFactory()->autolink($value, $this->tree), ['br']); |
| 1092 | 1092 | } |
| 1093 | - $value = strtr($value, [MarkdownFactory::BREAK => ' ']); |
|
| 1093 | + $value = strtr($value, [MarkdownFactory::break => ' ']); |
|
| 1094 | 1094 | } |
| 1095 | 1095 | |
| 1096 | 1096 | if (!empty($attrs['truncate'])) { |
@@ -1899,7 +1899,7 @@ |
||
| 1899 | 1899 | ->groupBy(['xref']); |
| 1900 | 1900 | }) |
| 1901 | 1901 | ->get() |
| 1902 | - ->map(fn (object $row): GedcomRecord|null => Registry::gedcomRecordFactory()->make($row->xref, $this->tree, $row->new_gedcom ?: $row->old_gedcom)) |
|
| 1902 | + ->map(fn (object $row): GedcomRecord | null => Registry::gedcomRecordFactory()->make($row->xref, $this->tree, $row->new_gedcom ?: $row->old_gedcom)) |
|
| 1903 | 1903 | ->filter() |
| 1904 | 1904 | ->all(); |
| 1905 | 1905 | break; |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $currentLen = $endPos + 2; |
| 200 | 200 | $directive = substr($workingText, 0, $currentLen); |
| 201 | 201 | $workingText = substr($workingText, $currentLen); |
| 202 | - $result .= self::$waitingText . $directive; |
|
| 202 | + $result .= self::$waitingText . $directive; |
|
| 203 | 203 | self::$waitingText = ''; |
| 204 | 204 | break; |
| 205 | 205 | } |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | break; |
| 309 | 309 | } |
| 310 | 310 | self::$waitingText .= $currentLetter; |
| 311 | - $workingText = substr($workingText, $currentLen); |
|
| 311 | + $workingText = substr($workingText, $currentLen); |
|
| 312 | 312 | if ($openParIndex !== false) { |
| 313 | 313 | // Opening parentheses always inherit the following directionality |
| 314 | 314 | while (true) { |
@@ -318,13 +318,13 @@ discard block |
||
| 318 | 318 | if (str_starts_with($workingText, ' ')) { |
| 319 | 319 | // Spaces following this left parenthesis inherit the following directionality too |
| 320 | 320 | self::$waitingText .= ' '; |
| 321 | - $workingText = substr($workingText, 1); |
|
| 321 | + $workingText = substr($workingText, 1); |
|
| 322 | 322 | continue; |
| 323 | 323 | } |
| 324 | 324 | if (str_starts_with($workingText, ' ')) { |
| 325 | 325 | // Spaces following this left parenthesis inherit the following directionality too |
| 326 | 326 | self::$waitingText .= ' '; |
| 327 | - $workingText = substr($workingText, 6); |
|
| 327 | + $workingText = substr($workingText, 6); |
|
| 328 | 328 | continue; |
| 329 | 329 | } |
| 330 | 330 | break; |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | // Exceptions to this rule will be handled later during final clean-up. |
| 342 | 342 | // |
| 343 | 343 | if (self::$currentState !== '') { |
| 344 | - $result .= self::$waitingText; |
|
| 344 | + $result .= self::$waitingText; |
|
| 345 | 345 | self::$waitingText = ''; |
| 346 | 346 | } |
| 347 | 347 | break 2; // double break because we're waiting for more information |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | } |
| 471 | 471 | if (substr($result . "\n", 0, self::LENGTH_START) !== self::START_LTR && substr($result . "\n", 0, self::LENGTH_START) !== self::START_RTL) { |
| 472 | 472 | $leadingText .= substr($result, 0, 1); |
| 473 | - $result = substr($result, 1); |
|
| 473 | + $result = substr($result, 1); |
|
| 474 | 474 | continue; |
| 475 | 475 | } |
| 476 | 476 | $result = substr($result, 0, self::LENGTH_START) . $leadingText . substr($result, self::LENGTH_START); |
@@ -612,11 +612,11 @@ discard block |
||
| 612 | 612 | private static function breakCurrentSpan(string &$result): void |
| 613 | 613 | { |
| 614 | 614 | // Interrupt the current span, insert that <br>, and then continue the current span |
| 615 | - $result .= self::$waitingText; |
|
| 615 | + $result .= self::$waitingText; |
|
| 616 | 616 | self::$waitingText = ''; |
| 617 | 617 | |
| 618 | 618 | $breakString = '<' . self::$currentState . 'br>'; |
| 619 | - $result .= $breakString; |
|
| 619 | + $result .= $breakString; |
|
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | /** |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | break; |
| 674 | 674 | } // No more numeric strings |
| 675 | 675 | |
| 676 | - $tempResult .= substr($textSpan, 0, $posLRE + 3); // Copy everything preceding the numeric string |
|
| 676 | + $tempResult .= substr($textSpan, 0, $posLRE + 3); // Copy everything preceding the numeric string |
|
| 677 | 677 | $numericString = substr($textSpan, $posLRE + 3, $posPDF - $posLRE); // Separate the entire numeric string |
| 678 | 678 | $textSpan = substr($textSpan, $posPDF + 3); |
| 679 | 679 | $posColon = strpos($numericString, ':'); |
@@ -1140,7 +1140,7 @@ discard block |
||
| 1140 | 1140 | |
| 1141 | 1141 | // We're done: finish the span |
| 1142 | 1142 | $textSpan = self::starredName($textSpan, 'RTL'); // Wrap starred name in <u> and </u> tags |
| 1143 | - $result .= $textSpan . self::END_RTL; |
|
| 1143 | + $result .= $textSpan . self::END_RTL; |
|
| 1144 | 1144 | } |
| 1145 | 1145 | |
| 1146 | 1146 | if (self::$currentState !== 'LTR' && self::$currentState !== 'RTL') { |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return ResponseInterface |
| 55 | 55 | */ |
| 56 | - public function redirectUrl(UriInterface|string $url, int $code = StatusCodeInterface::STATUS_FOUND): ResponseInterface; |
|
| 56 | + public function redirectUrl(UriInterface | string $url, int $code = StatusCodeInterface::STATUS_FOUND): ResponseInterface; |
|
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * @param string|array<mixed>|object $content |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @return ResponseInterface |
| 64 | 64 | */ |
| 65 | - public function response(string|array|object $content = '', int $code = StatusCodeInterface::STATUS_OK, array $headers = []): ResponseInterface; |
|
| 65 | + public function response(string | array | object $content = '', int $code = StatusCodeInterface::STATUS_OK, array $headers = []): ResponseInterface; |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * Create and render a view, and embed it in an HTML page. |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * |
| 86 | 86 | * @return ResponseInterface |
| 87 | 87 | */ |
| 88 | - public function redirectUrl(UriInterface|string $url, int $code = StatusCodeInterface::STATUS_FOUND): ResponseInterface |
|
| 88 | + public function redirectUrl(UriInterface | string $url, int $code = StatusCodeInterface::STATUS_FOUND): ResponseInterface |
|
| 89 | 89 | { |
| 90 | 90 | return $this->response_factory |
| 91 | 91 | ->createResponse($code) |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | * @return ResponseInterface |
| 101 | 101 | */ |
| 102 | - public function response(string|array|object $content = '', int $code = StatusCodeInterface::STATUS_OK, array $headers = []): ResponseInterface |
|
| 102 | + public function response(string | array | object $content = '', int $code = StatusCodeInterface::STATUS_OK, array $headers = []): ResponseInterface |
|
| 103 | 103 | { |
| 104 | 104 | if ($content === '' && $code === StatusCodeInterface::STATUS_OK) { |
| 105 | 105 | $code = StatusCodeInterface::STATUS_NO_CONTENT; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | if (is_string($content)) { |
| 109 | 109 | $headers['content-type'] ??= 'text/html; charset=UTF-8'; |
| 110 | 110 | } else { |
| 111 | - $content = json_encode($content, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE); |
|
| 111 | + $content = json_encode($content, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE); |
|
| 112 | 112 | $headers['content-type'] ??= 'application/json'; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - if ($values[$i] !== '' || $children_with_values && !$element instanceof AbstractXrefElement) { |
|
| 160 | + if ($values[$i] !== '' || $children_with_values && !$element instanceof AbstractXrefElement) { |
|
| 161 | 161 | if ($values[$i] === '') { |
| 162 | 162 | $gedcom_lines[] = $levels[$i] . ' ' . $tags[$i]; |
| 163 | 163 | } else { |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | * |
| 232 | 232 | * @return array<string> |
| 233 | 233 | */ |
| 234 | - public function factsToAdd(Family|Individual $record, bool $include_hidden): array |
|
| 234 | + public function factsToAdd(Family | Individual $record, bool $include_hidden): array |
|
| 235 | 235 | { |
| 236 | 236 | $subtags = Registry::elementFactory()->make($record->tag())->subtags(); |
| 237 | 237 | |
@@ -114,7 +114,7 @@ |
||
| 114 | 114 | * |
| 115 | 115 | * @return ResponseInterface |
| 116 | 116 | */ |
| 117 | -function response(array|object|string $content = '', int $code = StatusCodeInterface::STATUS_OK, array $headers = []): ResponseInterface |
|
| 117 | +function response(array | object | string $content = '', int $code = StatusCodeInterface::STATUS_OK, array $headers = []): ResponseInterface |
|
| 118 | 118 | { |
| 119 | 119 | return Registry::responseFactory()->response($content, $code, $headers); |
| 120 | 120 | } |
@@ -301,7 +301,7 @@ |
||
| 301 | 301 | { |
| 302 | 302 | $latest_version = $this->fetchLatestVersion(false); |
| 303 | 303 | |
| 304 | - [, , $url] = explode('|', $latest_version . '||'); |
|
| 304 | + [,, $url] = explode('|', $latest_version . '||'); |
|
| 305 | 305 | |
| 306 | 306 | return $url; |
| 307 | 307 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * |
| 84 | 84 | * @return string |
| 85 | 85 | */ |
| 86 | - public function autolink(string $markdown, Tree|null $tree = null): string |
|
| 86 | + public function autolink(string $markdown, Tree | null $tree = null): string |
|
| 87 | 87 | { |
| 88 | 88 | // Create a minimal commonmark processor - just add support for auto-links. |
| 89 | 89 | $environment = new Environment(static::CONFIG_AUTOLINK); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * |
| 118 | 118 | * @return string |
| 119 | 119 | */ |
| 120 | - public function markdown(string $markdown, Tree|null $tree = null): string |
|
| 120 | + public function markdown(string $markdown, Tree | null $tree = null): string |
|
| 121 | 121 | { |
| 122 | 122 | $environment = new Environment(static::CONFIG_MARKDOWN); |
| 123 | 123 | $environment->addExtension(new CommonMarkCoreExtension()); |
@@ -50,13 +50,13 @@ discard block |
||
| 50 | 50 | class MarkdownFactory implements MarkdownFactoryInterface |
| 51 | 51 | { |
| 52 | 52 | // Commonmark uses the self-closing form of this tag, so we do the same for consistency. |
| 53 | - public const string BREAK = '<br />'; |
|
| 53 | + public const string break = '<br />'; |
|
| 54 | 54 | |
| 55 | 55 | protected const array CONFIG_AUTOLINK = [ |
| 56 | 56 | 'allow_unsafe_links' => false, |
| 57 | 57 | 'html_input' => HtmlFilter::ESCAPE, |
| 58 | 58 | 'renderer' => [ |
| 59 | - 'soft_break' => self::BREAK, |
|
| 59 | + 'soft_break' => self::break, |
|
| 60 | 60 | ], |
| 61 | 61 | ]; |
| 62 | 62 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | 'allow_unsafe_links' => false, |
| 65 | 65 | 'html_input' => HtmlFilter::ESCAPE, |
| 66 | 66 | 'renderer' => [ |
| 67 | - 'soft_break' => self::BREAK, |
|
| 67 | + 'soft_break' => self::break, |
|
| 68 | 68 | ], |
| 69 | 69 | 'table' => [ |
| 70 | 70 | 'wrap' => [ |