@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $dateTime = new \DateTime($date->{'raw'}); |
58 | 58 | $arr = [[$dateTime->format("Y"), $dateTime->format("m"), $dateTime->format("d")]]; |
59 | 59 | } catch (\Exception $e) { |
60 | - throw new CiteProcException("Could not parse date \"" . $date->{'raw'} . "\".", 0, $e); |
|
60 | + throw new CiteProcException("Could not parse date \"".$date->{'raw'}."\".", 0, $e); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return $arr; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } else if ($match === "any" && count($dateParts) === 2) { |
110 | 110 | return true; |
111 | 111 | } else { |
112 | - $ret = ($match === "all") ? $ret & true : $ret | true; |
|
112 | + $ret = ($match === "all") ? $ret&true : $ret|true; |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | return boolval($ret); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | $digitFrom = $from{$i}; |
66 | 66 | if ($digitTo !== $digitFrom) { |
67 | - $resTo = $digitTo . $resTo; |
|
67 | + $resTo = $digitTo.$resTo; |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | return $resTo; |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | { |
78 | 78 | |
79 | 79 | if ($from > 100 && ($from % 100 > 0) && intval(($from / 100), 10) === intval(($to / 100), 10)) { |
80 | - return "" . ($to % 100); |
|
80 | + return "".($to % 100); |
|
81 | 81 | } else if ($from >= 10000) { |
82 | - return "" . ($to % 1000); |
|
82 | + return "".($to % 1000); |
|
83 | 83 | } |
84 | 84 | return $to; |
85 | 85 | } |
@@ -74,7 +74,7 @@ |
||
74 | 74 | $len = strlen($numStr); |
75 | 75 | for ($pos = 0; $pos < $len; $pos++) { |
76 | 76 | $n = $numStr[$pos]; |
77 | - $ret = self::ROMAN_NUMERALS[$pos][$n] . $ret; |
|
77 | + $ret = self::ROMAN_NUMERALS[$pos][$n].$ret; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | return $ret; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | public static function capitalizeForTitle($titleString) |
94 | 94 | { |
95 | 95 | if (preg_match('/(.+[^\<\>][\.:\/;\?\!]\s?)([a-z])(.+)/', $titleString, $match)) { |
96 | - $titleString = $match[1] . StringHelper::mb_ucfirst($match[2]) . $match[3]; |
|
96 | + $titleString = $match[1].StringHelper::mb_ucfirst($match[2]).$match[3]; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | $wordArray = explode(" ", $titleString); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | /** @noinspection PhpInternalEntityUsedInspection */ |
143 | 143 | $encoding = Mbstring::mb_detect_encoding($firstChar, self::ISO_ENCODINGS, true); |
144 | - return in_array($encoding, self::ISO_ENCODINGS) ? Mbstring::mb_strtoupper($firstChar, $encoding) . $then : $firstChar . $then; |
|
144 | + return in_array($encoding, self::ISO_ENCODINGS) ? Mbstring::mb_strtoupper($firstChar, $encoding).$then : $firstChar.$then; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -160,13 +160,13 @@ discard block |
||
160 | 160 | foreach ($spaceExploded as $givenPart) { |
161 | 161 | $firstLetter = mb_substr($givenPart, 0, 1, "UTF-8"); |
162 | 162 | if (StringHelper::isLatinString($firstLetter)) { |
163 | - $res .= ctype_upper($firstLetter) ? $firstLetter . $initializeSign : " " . $givenPart . " "; |
|
163 | + $res .= ctype_upper($firstLetter) ? $firstLetter.$initializeSign : " ".$givenPart." "; |
|
164 | 164 | } else { |
165 | - $res .= $firstLetter . $initializeSign; |
|
165 | + $res .= $firstLetter.$initializeSign; |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | if ($i < count($exploded) - 1 && $initializeWithHyphen) { |
169 | - $res = rtrim($res) . "-"; |
|
169 | + $res = rtrim($res)."-"; |
|
170 | 170 | } |
171 | 171 | ++$i; |
172 | 172 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | public static function replaceOuterQuotes($text, $outerOpenQuote, $outerCloseQuote, $innerOpenQuote, $innerCloseQuote) |
225 | 225 | { |
226 | 226 | if (preg_match("/(.*)$outerOpenQuote(.+)$outerCloseQuote(.*)/u", $text, $match)) { |
227 | - return $match[1] . $innerOpenQuote . $match[2] . $innerCloseQuote . $match[3]; |
|
227 | + return $match[1].$innerOpenQuote.$match[2].$innerCloseQuote.$match[3]; |
|
228 | 228 | } |
229 | 229 | return $text; |
230 | 230 | } |
@@ -254,6 +254,6 @@ discard block |
||
254 | 254 | * @return mixed |
255 | 255 | */ |
256 | 256 | public static function removeBrackets($datePart) { |
257 | - return str_replace(["[","]", "(", ")", "{", "}"], "", $datePart); |
|
257 | + return str_replace(["[", "]", "(", ")", "{", "}"], "", $datePart); |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | \ No newline at end of file |
@@ -54,9 +54,9 @@ |
||
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()} does not exist any counterpart class \"" . $nodeClass . "\". The given stylesheet seems to be invalid."); |
|
59 | + throw new InvalidStylesheetException("For node {$node->getName()} does not exist any counterpart class \"".$nodeClass."\". The given stylesheet seems to be invalid."); |
|
60 | 60 | } |
61 | 61 | if ($param != null) { |
62 | 62 | return new $nodeClass($node, $param); |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public static function loadStyleSheet($styleName) |
36 | 36 | { |
37 | - $stylesPath = self::vendorPath() . "/citation-style-language/styles-distribution/"; |
|
38 | - return file_get_contents($stylesPath . $styleName . '.csl'); |
|
37 | + $stylesPath = self::vendorPath()."/citation-style-language/styles-distribution/"; |
|
38 | + return file_get_contents($stylesPath.$styleName.'.csl'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -48,14 +48,14 @@ discard block |
||
48 | 48 | public static function loadLocales($langKey) |
49 | 49 | { |
50 | 50 | $data = null; |
51 | - $localesPath = self::vendorPath() . "/citation-style-language/locales/"; |
|
52 | - $localeFile = $localesPath . "locales-" . $langKey . '.xml'; |
|
51 | + $localesPath = self::vendorPath()."/citation-style-language/locales/"; |
|
52 | + $localeFile = $localesPath."locales-".$langKey.'.xml'; |
|
53 | 53 | if (file_exists($localeFile)) { |
54 | 54 | $data = file_get_contents($localeFile); |
55 | 55 | } else { |
56 | 56 | $metadata = self::loadLocalesMetadata(); |
57 | 57 | if (!empty($metadata->{'primary-dialects'}->{$langKey})) { |
58 | - $data = file_get_contents($localesPath . "locales-" . $metadata->{'primary-dialects'}->{$langKey} . '.xml'); |
|
58 | + $data = file_get_contents($localesPath."locales-".$metadata->{'primary-dialects'}->{$langKey}.'.xml'); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public static function loadLocalesMetadata() |
70 | 70 | { |
71 | - $localesMetadataPath = self::vendorPath() . "/citation-style-language/locales/locales.json"; |
|
71 | + $localesMetadataPath = self::vendorPath()."/citation-style-language/locales/locales.json"; |
|
72 | 72 | return json_decode(file_get_contents($localesMetadataPath)); |
73 | 73 | } |
74 | 74 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | private static function vendorPath() |
80 | 80 | { |
81 | - include_once __DIR__ . '/../../../vendorPath.php'; |
|
81 | + include_once __DIR__.'/../../../vendorPath.php'; |
|
82 | 82 | if (!($vendorPath = vendorPath())) { |
83 | 83 | // @codeCoverageIgnoreStart |
84 | 84 | throw new CiteProcException('vendor path not found. Use composer to initialize your project'); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | foreach ($node->children() as $child) { |
95 | 95 | if ($child->getName() === "date-part") { |
96 | 96 | $datePartName = (string) $child->attributes()["name"]; |
97 | - $this->dateParts->set($this->form . "-" . $datePartName, Util\Factory::create($child)); |
|
97 | + $this->dateParts->set($this->form."-".$datePartName, Util\Factory::create($child)); |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
@@ -164,15 +164,15 @@ discard block |
||
164 | 164 | $toRender = 0; |
165 | 165 | if ($interval->y > 0 && in_array('year', $dateParts)) { |
166 | 166 | $toRender |= self::DATE_RANGE_STATE_YEAR; |
167 | - $delim = $this->dateParts->get($this->form . "-year")->getRangeDelimiter(); |
|
167 | + $delim = $this->dateParts->get($this->form."-year")->getRangeDelimiter(); |
|
168 | 168 | } |
169 | 169 | if ($interval->m > 0 && $from->getMonth() - $to->getMonth() !== 0 && in_array('month', $dateParts)) { |
170 | 170 | $toRender |= self::DATE_RANGE_STATE_MONTH; |
171 | - $delim = $this->dateParts->get($this->form . "-month")->getRangeDelimiter(); |
|
171 | + $delim = $this->dateParts->get($this->form."-month")->getRangeDelimiter(); |
|
172 | 172 | } |
173 | 173 | if ($interval->d > 0 && $from->getDay() - $to->getDay() !== 0 && in_array('day', $dateParts)) { |
174 | 174 | $toRender |= self::DATE_RANGE_STATE_DAY; |
175 | - $delim = $this->dateParts->get($this->form . "-day")->getRangeDelimiter(); |
|
175 | + $delim = $this->dateParts->get($this->form."-day")->getRangeDelimiter(); |
|
176 | 176 | } |
177 | 177 | if ($toRender === self::DATE_RANGE_STATE_NONE) { |
178 | 178 | $ret .= $this->iterateAndRenderDateParts($dateParts, $data_); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | if (isset($var->raw) && preg_match("/(\p{L}+)\s?([\-\-\&,])\s?(\p{L}+)/u", $var->raw, $matches)) { |
185 | - return $matches[1] . $matches[2] . $matches[3]; |
|
185 | + return $matches[1].$matches[2].$matches[3]; |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 | // fallback: |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | $t = $datePart[0]->renderWithoutAffixes($to, $this); |
367 | 367 | $t .= $datePart[0]->renderSuffix(); |
368 | 368 | $t .= $datePart[1]->render($to, $this); |
369 | - $ret .= $f . $delim . $t; |
|
369 | + $ret .= $f.$delim.$t; |
|
370 | 370 | } else { |
371 | 371 | $ret .= $datePart->render($from, $this); |
372 | 372 | } |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | $from = $datePart->renderWithoutAffixes($from, $this); |
390 | 390 | $to = $datePart->renderWithoutAffixes($to, $this); |
391 | 391 | $suffix = !empty($to) ? $datePart->renderSuffix() : ""; |
392 | - return $prefix . $from . $delim . $to . $suffix; |
|
392 | + return $prefix.$from.$delim.$to.$suffix; |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | /** |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | } |
495 | 495 | } else { //otherwise create default date parts |
496 | 496 | foreach ($dateParts as $datePart) { |
497 | - $this->dateParts->add("$form-$datePart", new DatePart(new \SimpleXMLElement('<date-part name="' . $datePart . '" form="' . $form . '" />'))); |
|
497 | + $this->dateParts->add("$form-$datePart", new DatePart(new \SimpleXMLElement('<date-part name="'.$datePart.'" form="'.$form.'" />'))); |
|
498 | 498 | } |
499 | 499 | } |
500 | 500 | } |