@@ -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; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } else if ($match === "any" && count($dateParts) === 2) { |
113 | 113 | return true; |
114 | 114 | } else { |
115 | - $ret = ($match === "all") ? $ret & true : $ret | true; |
|
115 | + $ret = ($match === "all") ? $ret&true : $ret|true; |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | return boolval($ret); |
@@ -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); |
@@ -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 | } |
@@ -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 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | foreach ($this->conditionVariables as $variable) { |
72 | 72 | $conditionMatched |= $this->matchForVariable($variable, $value); |
73 | 73 | } |
74 | - return (bool)$conditionMatched; |
|
74 | + return (bool) $conditionMatched; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | private function matchAll($value) |
@@ -80,6 +80,6 @@ discard block |
||
80 | 80 | foreach ($this->conditionVariables as $variable) { |
81 | 81 | $conditionMatched &= $this->matchForVariable($variable, $value); |
82 | 82 | } |
83 | - return (bool)$conditionMatched; |
|
83 | + return (bool) $conditionMatched; |
|
84 | 84 | } |
85 | 85 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public static function getCompareNumber() |
52 | 52 | { |
53 | - return function ($numA, $numB, $order) { |
|
53 | + return function($numA, $numB, $order) { |
|
54 | 54 | if (is_numeric($numA) && is_numeric($numB)) { |
55 | 55 | $ret = $numA - $numB; |
56 | 56 | } else { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $len = strlen($numStr); |
77 | 77 | for ($pos = 0; $pos < $len; $pos++) { |
78 | 78 | $n = $numStr[$pos]; |
79 | - $ret = self::ROMAN_NUMERALS[$pos][$n] . $ret; |
|
79 | + $ret = self::ROMAN_NUMERALS[$pos][$n].$ret; |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | return $ret; |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | foreach ($node->attributes() as $attribute) { |
61 | 61 | switch ($attribute->getName()) { |
62 | 62 | case 'variable': |
63 | - $this->variable = (string)$attribute; |
|
63 | + $this->variable = (string) $attribute; |
|
64 | 64 | break; |
65 | 65 | case 'form': |
66 | - $this->form = (string)$attribute; |
|
66 | + $this->form = (string) $attribute; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | if (empty($ordinalSuffix)) { |
159 | 159 | $ordinalSuffix = CiteProc::getContext()->getLocale()->filter('terms', 'ordinal')->single; |
160 | 160 | } |
161 | - return $num . $ordinalSuffix; |
|
161 | + return $num.$ordinalSuffix; |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | public static function longOrdinal($num) |
169 | 169 | { |
170 | 170 | $num = sprintf("%02d", $num); |
171 | - $ret = CiteProc::getContext()->getLocale()->filter('terms', 'long-ordinal-' . $num)->single; |
|
171 | + $ret = CiteProc::getContext()->getLocale()->filter('terms', 'long-ordinal-'.$num)->single; |
|
172 | 172 | if (!$ret) { |
173 | 173 | return self::ordinal($num); |
174 | 174 | } |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | { |
186 | 186 | |
187 | 187 | if (self::RANGE_DELIMITER_AMPERSAND === $delim) { |
188 | - $numRange = "$num1 " . htmlentities(self::RANGE_DELIMITER_AMPERSAND) . " $num2"; |
|
188 | + $numRange = "$num1 ".htmlentities(self::RANGE_DELIMITER_AMPERSAND)." $num2"; |
|
189 | 189 | } else { |
190 | 190 | if (self::RANGE_DELIMITER_COMMA === $delim) { |
191 | - $numRange = $num1 . htmlentities(self::RANGE_DELIMITER_COMMA) . " $num2"; |
|
191 | + $numRange = $num1.htmlentities(self::RANGE_DELIMITER_COMMA)." $num2"; |
|
192 | 192 | } else { |
193 | - $numRange = $num1 . self::RANGE_DELIMITER_HYPHEN . $num2; |
|
193 | + $numRange = $num1.self::RANGE_DELIMITER_HYPHEN.$num2; |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | return $numRange; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | if (preg_match("/\s*([^\-\-&,]+)\s*([\-\-&,])\s*([^\-\-&,]+)\s*/", $number, $matches)) { |
208 | 208 | $num1 = Util\NumberHelper::roman2Dec($matches[1]); |
209 | 209 | $num2 = Util\NumberHelper::roman2Dec($matches[3]); |
210 | - $decimalNumber = $num1 . $matches[2] . $num2; |
|
210 | + $decimalNumber = $num1.$matches[2].$num2; |
|
211 | 211 | } else { |
212 | 212 | $decimalNumber = Util\NumberHelper::roman2Dec($number); |
213 | 213 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $className = "YearMonthDayRenderer"; |
70 | 70 | break; |
71 | 71 | } |
72 | - return __NAMESPACE__ . "\\" . $className; |
|
72 | + return __NAMESPACE__."\\".$className; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $from = $datePart->renderWithoutAffixes($from, $this->parentDateObject); |
95 | 95 | $to = $datePart->renderWithoutAffixes($to, $this->parentDateObject); |
96 | 96 | $suffix = !empty($to) ? $datePart->renderSuffix() : ""; |
97 | - return $prefix . $from . $delimiter . $to . $suffix; |
|
97 | + return $prefix.$from.$delimiter.$to.$suffix; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | protected function renderDateParts($dateParts, $from, $to, $delimiter) |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $renderedTo = $datePart[0]->renderWithoutAffixes($to, $this->parentDateObject); |
110 | 110 | $renderedTo .= $datePart[0]->renderSuffix(); |
111 | 111 | $renderedTo .= $datePart[1]->render($to, $this->parentDateObject); |
112 | - $ret .= $renderedFrom . $delimiter . $renderedTo; |
|
112 | + $ret .= $renderedFrom.$delimiter.$renderedTo; |
|
113 | 113 | } else { |
114 | 114 | $ret .= $datePart->render($from, $this->parentDateObject); |
115 | 115 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | foreach ($node->children() as $child) { |
99 | 99 | if ($child->getName() === "date-part") { |
100 | 100 | $datePartName = (string) $child->attributes()["name"]; |
101 | - $this->dateParts->set($this->form . "-" . $datePartName, Util\Factory::create($child)); |
|
101 | + $this->dateParts->set($this->form."-".$datePartName, Util\Factory::create($child)); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
@@ -173,15 +173,15 @@ discard block |
||
173 | 173 | $toRender = 0; |
174 | 174 | if ($interval->y > 0 && in_array('year', $dateParts)) { |
175 | 175 | $toRender |= self::DATE_RANGE_STATE_YEAR; |
176 | - $delimiter = $this->dateParts->get($this->form . "-year")->getRangeDelimiter(); |
|
176 | + $delimiter = $this->dateParts->get($this->form."-year")->getRangeDelimiter(); |
|
177 | 177 | } |
178 | 178 | if ($interval->m > 0 && $from->getMonth() - $to->getMonth() !== 0 && in_array('month', $dateParts)) { |
179 | 179 | $toRender |= self::DATE_RANGE_STATE_MONTH; |
180 | - $delimiter = $this->dateParts->get($this->form . "-month")->getRangeDelimiter(); |
|
180 | + $delimiter = $this->dateParts->get($this->form."-month")->getRangeDelimiter(); |
|
181 | 181 | } |
182 | 182 | if ($interval->d > 0 && $from->getDay() - $to->getDay() !== 0 && in_array('day', $dateParts)) { |
183 | 183 | $toRender |= self::DATE_RANGE_STATE_DAY; |
184 | - $delimiter = $this->dateParts->get($this->form . "-day")->getRangeDelimiter(); |
|
184 | + $delimiter = $this->dateParts->get($this->form."-day")->getRangeDelimiter(); |
|
185 | 185 | } |
186 | 186 | if ($toRender === self::DATE_RANGE_STATE_NONE) { |
187 | 187 | $ret .= $this->iterateAndRenderDateParts($dateParts, $data_); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | } |
192 | 192 | |
193 | 193 | if (isset($var->raw) && preg_match("/(\p{L}+)\s?([\-\-&,])\s?(\p{L}+)/u", $var->raw, $matches)) { |
194 | - return $matches[1] . $matches[2] . $matches[3]; |
|
194 | + return $matches[1].$matches[2].$matches[3]; |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 | // fallback: |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | } |
342 | 342 | } else { //otherwise create default date parts |
343 | 343 | foreach ($dateParts as $datePart) { |
344 | - $this->dateParts->add("$form-$datePart", new DatePart(new SimpleXMLElement('<date-part name="' . $datePart . '" form="' . $form . '" />'))); |
|
344 | + $this->dateParts->add("$form-$datePart", new DatePart(new SimpleXMLElement('<date-part name="'.$datePart.'" form="'.$form.'" />'))); |
|
345 | 345 | } |
346 | 346 | } |
347 | 347 | } |