@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | { |
| 78 | 78 | $wordArray = explode(" ", $text); |
| 79 | 79 | |
| 80 | - array_walk($wordArray, function (&$word) { |
|
| 80 | + array_walk($wordArray, function(&$word) { |
|
| 81 | 81 | $word = ucfirst($word); |
| 82 | 82 | }); |
| 83 | 83 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | return ""; |
| 95 | 95 | } |
| 96 | 96 | if (preg_match('/(.+[^\<\>][\.:\/;\?\!]\s?)([a-z])(.+)/', $titleString, $match)) { |
| 97 | - $titleString = $match[1].StringHelper::mb_ucfirst($match[2]).$match[3]; |
|
| 97 | + $titleString = $match[1] . StringHelper::mb_ucfirst($match[2]) . $match[3]; |
|
| 98 | 98 | } |
| 99 | 99 | $pattern = "/(\s|\/)/"; |
| 100 | 100 | if (!preg_match($pattern, $titleString, $matches)) { |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | /** @noinspection PhpInternalEntityUsedInspection */ |
| 149 | 149 | $encoding = mb_detect_encoding($firstChar, self::ISO_ENCODINGS, true); |
| 150 | 150 | return in_array($encoding, self::ISO_ENCODINGS) ? |
| 151 | - mb_strtoupper($firstChar, $encoding).$then : $firstChar.$then; |
|
| 151 | + mb_strtoupper($firstChar, $encoding) . $then : $firstChar . $then; |
|
| 152 | 152 | } |
| 153 | 153 | // phpcs:disable |
| 154 | 154 | public static function mb_strrev($string) |
@@ -197,13 +197,13 @@ discard block |
||
| 197 | 197 | foreach ($spaceExploded as $givenPart) { |
| 198 | 198 | $firstLetter = mb_substr($givenPart, 0, 1, "UTF-8"); |
| 199 | 199 | if (StringHelper::isLatinString($firstLetter)) { |
| 200 | - $res .= ctype_upper($firstLetter) ? $firstLetter.$initializeSign : " ".$givenPart." "; |
|
| 200 | + $res .= ctype_upper($firstLetter) ? $firstLetter . $initializeSign : " " . $givenPart . " "; |
|
| 201 | 201 | } else { |
| 202 | - $res .= $firstLetter.$initializeSign; |
|
| 202 | + $res .= $firstLetter . $initializeSign; |
|
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | if ($i < count($exploded) - 1 && $initializeWithHyphen) { |
| 206 | - $res = rtrim($res)."-"; |
|
| 206 | + $res = rtrim($res) . "-"; |
|
| 207 | 207 | } |
| 208 | 208 | ++$i; |
| 209 | 209 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | $innerCloseQuote |
| 267 | 267 | ) { |
| 268 | 268 | if (preg_match("/(.*)$outerOpenQuote(.+)$outerCloseQuote(.*)/u", $text, $match)) { |
| 269 | - return $match[1].$innerOpenQuote.$match[2].$innerCloseQuote.$match[3]; |
|
| 269 | + return $match[1] . $innerOpenQuote . $match[2] . $innerCloseQuote . $match[3]; |
|
| 270 | 270 | } |
| 271 | 271 | return $text; |
| 272 | 272 | } |
@@ -54,10 +54,10 @@ |
||
| 54 | 54 | */ |
| 55 | 55 | public static function create($node, $param = null) |
| 56 | 56 | { |
| 57 | - $nodeClass = self::CITE_PROC_NODE_NAMESPACE.self::$nodes[$node->getName()]; |
|
| 57 | + $nodeClass = self::CITE_PROC_NODE_NAMESPACE . self::$nodes[$node->getName()]; |
|
| 58 | 58 | if (!class_exists($nodeClass)) { |
| 59 | - throw new InvalidStylesheetException("For node {$node->getName()} ". |
|
| 60 | - "does not exist any counterpart class \"".$nodeClass. |
|
| 59 | + throw new InvalidStylesheetException("For node {$node->getName()} " . |
|
| 60 | + "does not exist any counterpart class \"" . $nodeClass . |
|
| 61 | 61 | "\". The given stylesheet seems to be invalid."); |
| 62 | 62 | } |
| 63 | 63 | if ($param != null) { |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | */ |
| 53 | 53 | public static function getCompareNumber() |
| 54 | 54 | { |
| 55 | - return function ($numA, $numB, $order) { |
|
| 55 | + return function($numA, $numB, $order) { |
|
| 56 | 56 | if (is_numeric($numA) && is_numeric($numB)) { |
| 57 | 57 | $ret = $numA - $numB; |
| 58 | 58 | } else { |
@@ -23,8 +23,8 @@ |
||
| 23 | 23 | public static function createConstraint(string $name, string $value, string $match): Constraint |
| 24 | 24 | { |
| 25 | 25 | $parts = explode("-", $name); |
| 26 | - $className = implode("", array_map(function ($part) { |
|
| 27 | - return ucfirst($part);//overridden function |
|
| 26 | + $className = implode("", array_map(function($part) { |
|
| 27 | + return ucfirst($part); //overridden function |
|
| 28 | 28 | }, $parts)); |
| 29 | 29 | $className = self::NAMESPACE_CONSTRAINTS . $className; |
| 30 | 30 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | public static function longOrdinal($num) |
| 176 | 176 | { |
| 177 | 177 | $num = sprintf("%02d", $num); |
| 178 | - $ret = CiteProc::getContext()->getLocale()->filter('terms', 'long-ordinal-'.$num)->single; |
|
| 178 | + $ret = CiteProc::getContext()->getLocale()->filter('terms', 'long-ordinal-' . $num)->single; |
|
| 179 | 179 | if (!$ret) { |
| 180 | 180 | return self::ordinal($num); |
| 181 | 181 | } |
@@ -192,12 +192,12 @@ discard block |
||
| 192 | 192 | { |
| 193 | 193 | |
| 194 | 194 | if (self::RANGE_DELIMITER_AMPERSAND === $delim) { |
| 195 | - $numRange = "$num1 ".htmlentities(self::RANGE_DELIMITER_AMPERSAND)." $num2"; |
|
| 195 | + $numRange = "$num1 " . htmlentities(self::RANGE_DELIMITER_AMPERSAND) . " $num2"; |
|
| 196 | 196 | } else { |
| 197 | 197 | if (self::RANGE_DELIMITER_COMMA === $delim) { |
| 198 | - $numRange = $num1.htmlentities(self::RANGE_DELIMITER_COMMA)." $num2"; |
|
| 198 | + $numRange = $num1 . htmlentities(self::RANGE_DELIMITER_COMMA) . " $num2"; |
|
| 199 | 199 | } else { |
| 200 | - $numRange = $num1.self::RANGE_DELIMITER_HYPHEN.$num2; |
|
| 200 | + $numRange = $num1 . self::RANGE_DELIMITER_HYPHEN . $num2; |
|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | return $numRange; |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | } else { |
| 197 | 197 | $arr = []; |
| 198 | 198 | foreach ($data->editor as $editor) { |
| 199 | - $edt = $this->format($editor->family.", ".$editor->given); |
|
| 199 | + $edt = $this->format($editor->family . ", " . $editor->given); |
|
| 200 | 200 | $results[] = NameHelper::addExtendedMarkup('editor', $editor, $edt); |
| 201 | 201 | } |
| 202 | 202 | $str .= implode($this->delimiter, $arr); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $str .= $this->label->render($data); |
| 207 | 207 | } |
| 208 | 208 | $vars = $this->variables->toArray(); |
| 209 | - $vars = array_filter($vars, function ($value) { |
|
| 209 | + $vars = array_filter($vars, function($value) { |
|
| 210 | 210 | return !($value === "editor" || $value === "translator"); |
| 211 | 211 | }); |
| 212 | 212 | $this->variables->setArray($vars); |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | } |
| 231 | 231 | } else { |
| 232 | 232 | foreach ($data->{$var} as $name) { |
| 233 | - $formatted = $this->format($name->given." ".$name->family); |
|
| 233 | + $formatted = $this->format($name->given . " " . $name->family); |
|
| 234 | 234 | $results[] = NameHelper::addExtendedMarkup($var, $name, $formatted); |
| 235 | 235 | } |
| 236 | 236 | } |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | |
| 400 | 400 | private function filterEmpty(array $results) |
| 401 | 401 | { |
| 402 | - return array_filter($results, function ($item) { |
|
| 402 | + return array_filter($results, function($item) { |
|
| 403 | 403 | return !empty($item); |
| 404 | 404 | }); |
| 405 | 405 | } |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | $text = implode(" ", $resultNames); |
| 457 | 457 | } else { // >2 |
| 458 | 458 | $lastName = array_pop($resultNames); |
| 459 | - $text = implode($this->delimiter, $resultNames)." ".$lastName; |
|
| 459 | + $text = implode($this->delimiter, $resultNames) . " " . $lastName; |
|
| 460 | 460 | } |
| 461 | 461 | } |
| 462 | 462 | return $text; |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | { |
| 486 | 486 | $count = count($resultNames); |
| 487 | 487 | if (!empty($this->and) && $count > 1 && empty($this->etAl)) { |
| 488 | - $new = $this->and.' '.end($resultNames); // add and-prefix of the last name if "and" is defined |
|
| 488 | + $new = $this->and . ' ' . end($resultNames); // add and-prefix of the last name if "and" is defined |
|
| 489 | 489 | // set prefixed last name at the last position of $resultNames array |
| 490 | 490 | $resultNames[count($resultNames) - 1] = $new; |
| 491 | 491 | } |
@@ -542,8 +542,8 @@ discard block |
||
| 542 | 542 | |
| 543 | 543 | list($family, $given) = $this->renderNameParts($data); |
| 544 | 544 | |
| 545 | - $text = $family.(!empty($given) ? $this->sortSeparator.$given : ""); |
|
| 546 | - $text .= !empty($data->suffix) ? $this->sortSeparator.$data->suffix : ""; |
|
| 545 | + $text = $family . (!empty($given) ? $this->sortSeparator . $given : ""); |
|
| 546 | + $text .= !empty($data->suffix) ? $this->sortSeparator . $data->suffix : ""; |
|
| 547 | 547 | } elseif ($this->form === "long" |
| 548 | 548 | && $nameAsSortOrder |
| 549 | 549 | && (is_null($demoteNonDroppingParticle) |
@@ -554,13 +554,13 @@ discard block |
||
| 554 | 554 | NameHelper::appendParticleTo($data, "given", "non-dropping-particle"); |
| 555 | 555 | list($family, $given) = $this->renderNameParts($data); |
| 556 | 556 | $text = $family; |
| 557 | - $text .= !empty($given) ? $this->sortSeparator.$given : ""; |
|
| 558 | - $text .= !empty($data->suffix) ? $this->sortSeparator.$data->suffix : ""; |
|
| 557 | + $text .= !empty($given) ? $this->sortSeparator . $given : ""; |
|
| 558 | + $text .= !empty($data->suffix) ? $this->sortSeparator . $data->suffix : ""; |
|
| 559 | 559 | } elseif ($this->form === "long" && $nameAsSortOrder && empty($demoteNonDroppingParticle)) { |
| 560 | 560 | list($family, $given) = $this->renderNameParts($data); |
| 561 | 561 | $text = $family; |
| 562 | - $text .= !empty($given) ? $this->delimiter.$given : ""; |
|
| 563 | - $text .= !empty($data->suffix) ? $this->sortSeparator.$data->suffix : ""; |
|
| 562 | + $text .= !empty($given) ? $this->delimiter . $given : ""; |
|
| 563 | + $text .= !empty($data->suffix) ? $this->sortSeparator . $data->suffix : ""; |
|
| 564 | 564 | } elseif ($this->form === "short") { |
| 565 | 565 | // [La] [Fontaine] |
| 566 | 566 | NameHelper::prependParticleTo($data, "family", "non-dropping-particle"); |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | NameHelper::prependParticleTo($data, "family", "dropping-particle"); |
| 572 | 572 | NameHelper::appendParticleTo($data, "family", "suffix"); |
| 573 | 573 | list($family, $given) = $this->renderNameParts($data); |
| 574 | - $text = !empty($given) ? $given." ".$family : $family; |
|
| 574 | + $text = !empty($given) ? $given . " " . $family : $family; |
|
| 575 | 575 | } |
| 576 | 576 | } elseif (StringHelper::isAsianString(NameHelper::normalizeName($data))) { |
| 577 | 577 | $text = $this->form === "long" ? $data->family . $data->given : $data->family; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | private function normalizeDateRange($page) |
| 189 | 189 | { |
| 190 | 190 | if (preg_match("/^(\d+)\s?--?\s?(\d+)$/", trim($page), $matches)) { |
| 191 | - return $matches[1]."-".$matches[2]; |
|
| 191 | + return $matches[1] . "-" . $matches[2]; |
|
| 192 | 192 | } |
| 193 | 193 | return $page; |
| 194 | 194 | } |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | $macro = CiteProc::getContext()->getMacro($this->toRenderTypeValue); |
| 283 | 283 | if (is_null($macro)) { |
| 284 | 284 | try { |
| 285 | - throw new CiteProcException("Macro \"".$this->toRenderTypeValue."\" does not exist."); |
|
| 285 | + throw new CiteProcException("Macro \"" . $this->toRenderTypeValue . "\" does not exist."); |
|
| 286 | 286 | } catch (CiteProcException $e) { |
| 287 | 287 | $renderedText = ""; |
| 288 | 288 | } |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | */ |
| 49 | 49 | public static function loadLocales(string $langKey): string |
| 50 | 50 | { |
| 51 | - $localesPath = self::vendorPath()."/citation-style-language/locales"; |
|
| 51 | + $localesPath = self::vendorPath() . "/citation-style-language/locales"; |
|
| 52 | 52 | $localeFile = "$localesPath/locales-${langKey}.xml"; |
| 53 | 53 | if (file_exists($localeFile)) { |
| 54 | 54 | return self::readFileContentsOrThrowException($localeFile); |