@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $dateTime = new DateTime($date->{'raw'}); |
| 60 | 60 | $arr = [[$dateTime->format("Y"), $dateTime->format("m"), $dateTime->format("d")]]; |
| 61 | 61 | } catch (Exception $e) { |
| 62 | - throw new CiteProcException("Could not parse date \"".$date->{'raw'}."\".", 0, $e); |
|
| 62 | + throw new CiteProcException("Could not parse date \"" . $date->{'raw'} . "\".", 0, $e); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | return $arr; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | } elseif ($match === "any" && count($dateParts) === 2) { |
| 112 | 112 | return true; |
| 113 | 113 | } else { |
| 114 | - $ret = ($match === "all") ? $ret&true : $ret|true; |
|
| 114 | + $ret = ($match === "all") ? $ret&true : $ret | true; |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | return (bool) $ret; |
@@ -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 | } |
@@ -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); |