@@ -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 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | foreach ($node->attributes() as $attribute) { |
| 103 | 103 | switch ($attribute->getName()) { |
| 104 | 104 | case 'form': |
| 105 | - $this->form = (string)$attribute; |
|
| 105 | + $this->form = (string) $attribute; |
|
| 106 | 106 | break; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | cs:names element (taking into account the effects of et-al abbreviation and editor/translator collapsing), |
| 167 | 167 | which allows for advanced sorting. */ |
| 168 | 168 | if ($this->form == 'count') { |
| 169 | - return (int)count($resultNames); |
|
| 169 | + return (int) count($resultNames); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | return $text; |
@@ -270,17 +270,17 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | switch ($this->delimiterPrecedesEtAl) { |
| 272 | 272 | case 'never': |
| 273 | - $text = $text . " " . $this->etAl; |
|
| 273 | + $text = $text." ".$this->etAl; |
|
| 274 | 274 | break; |
| 275 | 275 | case 'always': |
| 276 | - $text = $text . $this->delimiter . $this->etAl; |
|
| 276 | + $text = $text.$this->delimiter.$this->etAl; |
|
| 277 | 277 | break; |
| 278 | 278 | case 'contextual': |
| 279 | 279 | default: |
| 280 | 280 | if (count($resultNames) === 1) { |
| 281 | - $text .= " " . $this->etAl; |
|
| 281 | + $text .= " ".$this->etAl; |
|
| 282 | 282 | } else { |
| 283 | - $text .= $this->delimiter . $this->etAl; |
|
| 283 | + $text .= $this->delimiter.$this->etAl; |
|
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | } |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | $text = implode(" ", $resultNames); |
| 466 | 466 | } else { // >2 |
| 467 | 467 | $lastName = array_pop($resultNames); |
| 468 | - $text = implode($this->delimiter, $resultNames) . " " . $lastName; |
|
| 468 | + $text = implode($this->delimiter, $resultNames)." ".$lastName; |
|
| 469 | 469 | } |
| 470 | 470 | } |
| 471 | 471 | return $text; |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | { |
| 495 | 495 | $count = count($resultNames); |
| 496 | 496 | if (!empty($this->and) && $count > 1 && empty($this->etAl)) { |
| 497 | - $new = $this->and . ' ' . end($resultNames); // add and-prefix of the last name if "and" is defined |
|
| 497 | + $new = $this->and.' '.end($resultNames); // add and-prefix of the last name if "and" is defined |
|
| 498 | 498 | $resultNames[count($resultNames) - 1] = $new; //set prefixed last name at the last position of $resultNames array |
| 499 | 499 | } |
| 500 | 500 | } |
@@ -540,8 +540,8 @@ discard block |
||
| 540 | 540 | |
| 541 | 541 | if (StringHelper::isLatinString(NameHelper::normalizeName($data)) || StringHelper::isCyrillicString(NameHelper::normalizeName($data))) { |
| 542 | 542 | if ($this->form === "long" && $nameAsSortOrder && |
| 543 | - ((string)$demoteNonDroppingParticle === DemoteNonDroppingParticle::NEVER || |
|
| 544 | - (string)$demoteNonDroppingParticle === DemoteNonDroppingParticle::SORT_ONLY) |
|
| 543 | + ((string) $demoteNonDroppingParticle === DemoteNonDroppingParticle::NEVER || |
|
| 544 | + (string) $demoteNonDroppingParticle === DemoteNonDroppingParticle::SORT_ONLY) |
|
| 545 | 545 | ) { |
| 546 | 546 | |
| 547 | 547 | // [La] [Fontaine], [Jean] [de], [III] |
@@ -550,11 +550,11 @@ discard block |
||
| 550 | 550 | |
| 551 | 551 | list($family, $given) = $this->renderNameParts($data); |
| 552 | 552 | |
| 553 | - $text = $family . (!empty($given) ? $this->sortSeparator . $given : ""); |
|
| 554 | - $text .= !empty($data->suffix) ? $this->sortSeparator . $data->suffix : ""; |
|
| 553 | + $text = $family.(!empty($given) ? $this->sortSeparator.$given : ""); |
|
| 554 | + $text .= !empty($data->suffix) ? $this->sortSeparator.$data->suffix : ""; |
|
| 555 | 555 | } else if ($this->form === "long" && $nameAsSortOrder && |
| 556 | 556 | (is_null($demoteNonDroppingParticle) || |
| 557 | - (string)$demoteNonDroppingParticle === DemoteNonDroppingParticle::DISPLAY_AND_SORT) |
|
| 557 | + (string) $demoteNonDroppingParticle === DemoteNonDroppingParticle::DISPLAY_AND_SORT) |
|
| 558 | 558 | ) { |
| 559 | 559 | // [Fontaine], [Jean] [de] [La], [III] |
| 560 | 560 | |
@@ -562,14 +562,14 @@ discard block |
||
| 562 | 562 | NameHelper::appendParticleTo($data, "given", "non-dropping-particle"); |
| 563 | 563 | list($family, $given) = $this->renderNameParts($data); |
| 564 | 564 | $text = $family; |
| 565 | - $text .= !empty($given) ? $this->sortSeparator . $given : ""; |
|
| 566 | - $text .= !empty($data->suffix) ? $this->sortSeparator . $data->suffix : ""; |
|
| 565 | + $text .= !empty($given) ? $this->sortSeparator.$given : ""; |
|
| 566 | + $text .= !empty($data->suffix) ? $this->sortSeparator.$data->suffix : ""; |
|
| 567 | 567 | |
| 568 | 568 | } else if ($this->form === "long" && $nameAsSortOrder && empty($demoteNonDroppingParticle)) { |
| 569 | 569 | list($family, $given) = $this->renderNameParts($data); |
| 570 | 570 | $text = $family; |
| 571 | - $text .= !empty($given) ? $this->delimiter . $given : ""; |
|
| 572 | - $text .= !empty($data->suffix) ? $this->sortSeparator . $data->suffix : ""; |
|
| 571 | + $text .= !empty($given) ? $this->delimiter.$given : ""; |
|
| 572 | + $text .= !empty($data->suffix) ? $this->sortSeparator.$data->suffix : ""; |
|
| 573 | 573 | } else if ($this->form === "short") { |
| 574 | 574 | // [La] [Fontaine] |
| 575 | 575 | NameHelper::prependParticleTo($data, "family", "non-dropping-particle"); |
@@ -581,10 +581,10 @@ discard block |
||
| 581 | 581 | NameHelper::prependParticleTo($data, "family", "dropping-particle"); |
| 582 | 582 | NameHelper::appendParticleTo($data, "family", "suffix"); |
| 583 | 583 | list($family, $given) = $this->renderNameParts($data); |
| 584 | - $text = !empty($given) ? $given . " " . $family : $family; |
|
| 584 | + $text = !empty($given) ? $given." ".$family : $family; |
|
| 585 | 585 | } |
| 586 | 586 | } else { |
| 587 | - $text = $this->form === "long" ? $data->family . " " . $data->given : $data->family; |
|
| 587 | + $text = $this->form === "long" ? $data->family." ".$data->given : $data->family; |
|
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | return $text; |