@@ -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 realpath(__DIR__ . '/../') . '/vendorPath.php'; |
|
81 | + include_once realpath(__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'); |
@@ -41,13 +41,13 @@ |
||
41 | 41 | $attr = ""; |
42 | 42 | for ($i = count($nameParts) - 1; $i >= 0; --$i) { |
43 | 43 | if ($i > 0) { |
44 | - $attr = ucfirst($nameParts[$i]) . $attr; |
|
44 | + $attr = ucfirst($nameParts[$i]).$attr; |
|
45 | 45 | } else { |
46 | - $attr = $nameParts[$i] . $attr; |
|
46 | + $attr = $nameParts[$i].$attr; |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | if (!isset($this->{$attr})) { |
50 | - throw new InvalidArgumentException("Property \"$attr\" ($name) does not exist in " . __CLASS__); |
|
50 | + throw new InvalidArgumentException("Property \"$attr\" ($name) does not exist in ".__CLASS__); |
|
51 | 51 | } |
52 | 52 | $this->{$attr} = $value; |
53 | 53 | } |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | // test case group_ShortOutputOnly.json |
186 | 186 | $renderedText = ""; |
187 | 187 | if (in_array($this->form, ["short", "long"])) { |
188 | - $attrWithPrefix = $this->form . ucfirst($this->toRenderTypeValue); |
|
189 | - $attrWithSuffix = $this->toRenderTypeValue . "-" . $this->form; |
|
188 | + $attrWithPrefix = $this->form.ucfirst($this->toRenderTypeValue); |
|
189 | + $attrWithSuffix = $this->toRenderTypeValue."-".$this->form; |
|
190 | 190 | if (isset($data->{$attrWithPrefix}) && !empty($data->{$attrWithPrefix})) { |
191 | 191 | $renderedText = $this->applyTextCase(StringHelper::clearApostrophes($data->{$attrWithPrefix}), $lang); |
192 | 192 | } else { |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $macro = CiteProc::getContext()->getMacro($this->toRenderTypeValue); |
247 | 247 | if (is_null($macro)) { |
248 | 248 | try { |
249 | - throw new CiteProcException("Macro \"" . $this->toRenderTypeValue . "\" does not exist."); |
|
249 | + throw new CiteProcException("Macro \"".$this->toRenderTypeValue."\" does not exist."); |
|
250 | 250 | } catch (CiteProcException $e) { |
251 | 251 | $renderedText = ""; |
252 | 252 | } |
@@ -126,8 +126,8 @@ |
||
126 | 126 | public function renderNumeric() |
127 | 127 | { |
128 | 128 | $ret = $this->year; |
129 | - $ret .= $this->month > 0 && $this->month < 13 ? "-" . sprintf("%02s", $this->month) : ""; |
|
130 | - $ret .= $this->day > 0 && $this->day < 32 ? "-" . sprintf("%02s", $this->day) : ""; |
|
129 | + $ret .= $this->month > 0 && $this->month < 13 ? "-".sprintf("%02s", $this->month) : ""; |
|
130 | + $ret .= $this->day > 0 && $this->day < 32 ? "-".sprintf("%02s", $this->day) : ""; |
|
131 | 131 | return $ret; |
132 | 132 | } |
133 | 133 | } |
134 | 134 | \ No newline at end of file |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | foreach ($node->children() as $child) { |
98 | 98 | if ($child->getName() === "date-part") { |
99 | 99 | $datePartName = (string) $child->attributes()["name"]; |
100 | - $this->dateParts->set($this->form . "-" . $datePartName, Util\Factory::create($child)); |
|
100 | + $this->dateParts->set($this->form."-".$datePartName, Util\Factory::create($child)); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
@@ -167,15 +167,15 @@ discard block |
||
167 | 167 | $toRender = 0; |
168 | 168 | if ($interval->y > 0 && in_array('year', $dateParts)) { |
169 | 169 | $toRender |= self::DATE_RANGE_STATE_YEAR; |
170 | - $delim = $this->dateParts->get($this->form . "-year")->getRangeDelimiter(); |
|
170 | + $delim = $this->dateParts->get($this->form."-year")->getRangeDelimiter(); |
|
171 | 171 | } |
172 | 172 | if ($interval->m > 0 && $from->getMonth() - $to->getMonth() !== 0 && in_array('month', $dateParts)) { |
173 | 173 | $toRender |= self::DATE_RANGE_STATE_MONTH; |
174 | - $delim = $this->dateParts->get($this->form . "-month")->getRangeDelimiter(); |
|
174 | + $delim = $this->dateParts->get($this->form."-month")->getRangeDelimiter(); |
|
175 | 175 | } |
176 | 176 | if ($interval->d > 0 && $from->getDay() - $to->getDay() !== 0 && in_array('day', $dateParts)) { |
177 | 177 | $toRender |= self::DATE_RANGE_STATE_DAY; |
178 | - $delim = $this->dateParts->get($this->form . "-day")->getRangeDelimiter(); |
|
178 | + $delim = $this->dateParts->get($this->form."-day")->getRangeDelimiter(); |
|
179 | 179 | } |
180 | 180 | if ($toRender === self::DATE_RANGE_STATE_NONE) { |
181 | 181 | $ret .= $this->iterateAndRenderDateParts($dateParts, $data_); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | if (isset($var->raw) && preg_match("/(\p{L}+)\s?([\-\-&,])\s?(\p{L}+)/u", $var->raw, $matches)) { |
188 | - return $matches[1] . $matches[2] . $matches[3]; |
|
188 | + return $matches[1].$matches[2].$matches[3]; |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | // fallback: |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | $renderedTo = $datePart[0]->renderWithoutAffixes($to, $this); |
367 | 367 | $renderedTo .= $datePart[0]->renderSuffix(); |
368 | 368 | $renderedTo .= $datePart[1]->render($to, $this); |
369 | - $ret .= $renderedFrom . $delim . $renderedTo; |
|
369 | + $ret .= $renderedFrom.$delim.$renderedTo; |
|
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 | } |
@@ -146,11 +146,11 @@ discard block |
||
146 | 146 | { |
147 | 147 | $text = $date->getYear(); |
148 | 148 | if ($text > 0 && $text < 1000) { |
149 | - $text = $text . CiteProc::getContext()->getLocale()->filter("terms", "ad")->single; |
|
149 | + $text = $text.CiteProc::getContext()->getLocale()->filter("terms", "ad")->single; |
|
150 | 150 | return $text; |
151 | 151 | } elseif ($text < 0) { |
152 | 152 | $text = $text * -1; |
153 | - $text = $text . CiteProc::getContext()->getLocale()->filter("terms", "bc")->single; |
|
153 | + $text = $text.CiteProc::getContext()->getLocale()->filter("terms", "bc")->single; |
|
154 | 154 | return $text; |
155 | 155 | } |
156 | 156 | return $text; |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | if (empty($form)) { |
224 | 224 | $form = "long"; |
225 | 225 | } |
226 | - $month = 'month-' . sprintf('%02d', $text); |
|
226 | + $month = 'month-'.sprintf('%02d', $text); |
|
227 | 227 | $text = CiteProc::getContext()->getLocale()->filter('terms', $month, $form)->single; |
228 | 228 | return $text; |
229 | 229 | } |
@@ -86,13 +86,12 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | if (CiteProc::getContext()->isModeBibliography()) { |
89 | - foreach ($data as $citationNumber => $item) { |
|
90 | - ++self::$numberOfCitedItems; |
|
89 | + foreach ($data as $citationNumber => $item) {++self::$numberOfCitedItems; |
|
91 | 90 | CiteProc::getContext()->getResults()->append($this->wrapBibEntry($item, $this->renderSingle($item, $citationNumber))); |
92 | 91 | } |
93 | 92 | $ret .= implode($this->delimiter, CiteProc::getContext()->getResults()->toArray()); |
94 | 93 | $ret = StringHelper::clearApostrophes($ret); |
95 | - return "<div class=\"csl-bib-body\">" . $ret . "\n</div>"; |
|
94 | + return "<div class=\"csl-bib-body\">".$ret."\n</div>"; |
|
96 | 95 | |
97 | 96 | } else if (CiteProc::getContext()->isModeCitation()) { |
98 | 97 | if ($citationItems->count() > 0) { //is there a filter for specific citations? |
@@ -140,9 +139,9 @@ discard block |
||
140 | 139 | |
141 | 140 | if (!empty($inMargin) && !empty($margin) && CiteProc::getContext()->isModeBibliography()) { |
142 | 141 | $leftMargin = $this->removeConsecutiveChars($this->htmlentities($this->format(implode("", $inMargin)))); |
143 | - $rightInline = $this->removeConsecutiveChars($this->htmlentities($this->format(implode("", $margin))) . $this->suffix); |
|
144 | - $res = '<div class="csl-left-margin">' . $leftMargin . '</div>'; |
|
145 | - $res .= '<div class="csl-right-inline">' . $rightInline . '</div>'; |
|
142 | + $rightInline = $this->removeConsecutiveChars($this->htmlentities($this->format(implode("", $margin))).$this->suffix); |
|
143 | + $res = '<div class="csl-left-margin">'.$leftMargin.'</div>'; |
|
144 | + $res .= '<div class="csl-right-inline">'.$rightInline.'</div>'; |
|
146 | 145 | return $res; |
147 | 146 | } else if (!empty($inMargin)) { |
148 | 147 | $res = $this->format(implode("", $inMargin)); |
@@ -166,9 +165,9 @@ discard block |
||
166 | 165 | private function wrapBibEntry($dataItem, $value) |
167 | 166 | { |
168 | 167 | $value = $this->addAffixes($value); |
169 | - return "\n " . |
|
170 | - "<div class=\"csl-entry\">" . |
|
171 | - $renderedItem = CiteProcHelper::applyAdditionMarkupFunction($dataItem, "csl-entry", $value) . |
|
168 | + return "\n ". |
|
169 | + "<div class=\"csl-entry\">". |
|
170 | + $renderedItem = CiteProcHelper::applyAdditionMarkupFunction($dataItem, "csl-entry", $value). |
|
172 | 171 | "</div>"; |
173 | 172 | } |
174 | 173 |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | foreach ($node->attributes() as $attribute) { |
99 | 99 | switch ($attribute->getName()) { |
100 | 100 | case 'form': |
101 | - $this->form = (string)$attribute; |
|
101 | + $this->form = (string) $attribute; |
|
102 | 102 | break; |
103 | 103 | } |
104 | 104 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | cs:names element (taking into account the effects of et-al abbreviation and editor/translator collapsing), |
161 | 161 | which allows for advanced sorting. */ |
162 | 162 | if ($this->form == 'count') { |
163 | - return (int)count($resultNames); |
|
163 | + return (int) count($resultNames); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | return $text; |
@@ -262,17 +262,17 @@ discard block |
||
262 | 262 | |
263 | 263 | switch ($this->delimiterPrecedesEtAl) { |
264 | 264 | case 'never': |
265 | - $text = $text . " " . $this->etAl; |
|
265 | + $text = $text." ".$this->etAl; |
|
266 | 266 | break; |
267 | 267 | case 'always': |
268 | - $text = $text . $this->delimiter . $this->etAl; |
|
268 | + $text = $text.$this->delimiter.$this->etAl; |
|
269 | 269 | break; |
270 | 270 | case 'contextual': |
271 | 271 | default: |
272 | 272 | if (count($resultNames) === 1) { |
273 | - $text .= " " . $this->etAl; |
|
273 | + $text .= " ".$this->etAl; |
|
274 | 274 | } else { |
275 | - $text .= $this->delimiter . $this->etAl; |
|
275 | + $text .= $this->delimiter.$this->etAl; |
|
276 | 276 | } |
277 | 277 | } |
278 | 278 | } |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | $text = implode(" ", $resultNames); |
455 | 455 | } else { // >2 |
456 | 456 | $lastName = array_pop($resultNames); |
457 | - $text = implode($this->delimiter, $resultNames) . " " . $lastName; |
|
457 | + $text = implode($this->delimiter, $resultNames)." ".$lastName; |
|
458 | 458 | } |
459 | 459 | } |
460 | 460 | return $text; |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | { |
484 | 484 | $count = count($resultNames); |
485 | 485 | if (!empty($this->and) && $count > 1 && empty($this->etAl)) { |
486 | - $new = $this->and . ' ' . end($resultNames); // add and-prefix of the last name if "and" is defined |
|
486 | + $new = $this->and.' '.end($resultNames); // add and-prefix of the last name if "and" is defined |
|
487 | 487 | $resultNames[count($resultNames) - 1] = $new; //set prefixed last name at the last position of $resultNames array |
488 | 488 | } |
489 | 489 | } |
@@ -528,8 +528,8 @@ discard block |
||
528 | 528 | |
529 | 529 | if (StringHelper::isLatinString(NameHelper::normalizeName($data)) || StringHelper::isCyrillicString(NameHelper::normalizeName($data))) { |
530 | 530 | if ($this->form === "long" && $nameAsSortOrder && |
531 | - ((string)$demoteNonDroppingParticle === DemoteNonDroppingParticle::NEVER || |
|
532 | - (string)$demoteNonDroppingParticle === DemoteNonDroppingParticle::SORT_ONLY) |
|
531 | + ((string) $demoteNonDroppingParticle === DemoteNonDroppingParticle::NEVER || |
|
532 | + (string) $demoteNonDroppingParticle === DemoteNonDroppingParticle::SORT_ONLY) |
|
533 | 533 | ) { |
534 | 534 | |
535 | 535 | // [La] [Fontaine], [Jean] [de], [III] |
@@ -538,11 +538,11 @@ discard block |
||
538 | 538 | |
539 | 539 | list($family, $given) = $this->renderNameParts($data); |
540 | 540 | |
541 | - $text = $family . (!empty($given) ? $this->sortSeparator . $given : ""); |
|
542 | - $text .= !empty($data->suffix) ? $this->sortSeparator . $data->suffix : ""; |
|
541 | + $text = $family.(!empty($given) ? $this->sortSeparator.$given : ""); |
|
542 | + $text .= !empty($data->suffix) ? $this->sortSeparator.$data->suffix : ""; |
|
543 | 543 | } else if ($this->form === "long" && $nameAsSortOrder && |
544 | 544 | (is_null($demoteNonDroppingParticle) || |
545 | - (string)$demoteNonDroppingParticle === DemoteNonDroppingParticle::DISPLAY_AND_SORT) |
|
545 | + (string) $demoteNonDroppingParticle === DemoteNonDroppingParticle::DISPLAY_AND_SORT) |
|
546 | 546 | ) { |
547 | 547 | // [Fontaine], [Jean] [de] [La], [III] |
548 | 548 | |
@@ -550,14 +550,14 @@ discard block |
||
550 | 550 | NameHelper::appendParticleTo($data, "given", "non-dropping-particle"); |
551 | 551 | list($family, $given) = $this->renderNameParts($data); |
552 | 552 | $text = $family; |
553 | - $text .= !empty($given) ? $this->sortSeparator . $given : ""; |
|
554 | - $text .= !empty($data->suffix) ? $this->sortSeparator . $data->suffix : ""; |
|
553 | + $text .= !empty($given) ? $this->sortSeparator.$given : ""; |
|
554 | + $text .= !empty($data->suffix) ? $this->sortSeparator.$data->suffix : ""; |
|
555 | 555 | |
556 | 556 | } else if ($this->form === "long" && $nameAsSortOrder && empty($demoteNonDroppingParticle)) { |
557 | 557 | list($family, $given) = $this->renderNameParts($data); |
558 | 558 | $text = $family; |
559 | - $text .= !empty($given) ? $this->delimiter . $given : ""; |
|
560 | - $text .= !empty($data->suffix) ? $this->sortSeparator . $data->suffix : ""; |
|
559 | + $text .= !empty($given) ? $this->delimiter.$given : ""; |
|
560 | + $text .= !empty($data->suffix) ? $this->sortSeparator.$data->suffix : ""; |
|
561 | 561 | } else if ($this->form === "short") { |
562 | 562 | // [La] [Fontaine] |
563 | 563 | NameHelper::prependParticleTo($data, "family", "non-dropping-particle"); |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | NameHelper::prependParticleTo($data, "family", "dropping-particle"); |
570 | 570 | NameHelper::appendParticleTo($data, "family", "suffix"); |
571 | 571 | list($family, $given) = $this->renderNameParts($data); |
572 | - $text = !empty($given) ? $given . " " . $family : $family; |
|
572 | + $text = !empty($given) ? $given." ".$family : $family; |
|
573 | 573 | } |
574 | 574 | } else { |
575 | 575 | $text = $this->form === "long" ? $data->family.$data->given : $data->family; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | } else { |
174 | 174 | $arr = []; |
175 | 175 | foreach ($data->editor as $editor) { |
176 | - $edt = $this->format($editor->family . ", " . $editor->given); |
|
176 | + $edt = $this->format($editor->family.", ".$editor->given); |
|
177 | 177 | $results[] = NameHelper::addExtendedMarkup('editor', $editor, $edt); |
178 | 178 | } |
179 | 179 | $str .= implode($this->delimiter, $arr); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } |
209 | 209 | } else { |
210 | 210 | foreach ($data->{$var} as $name) { |
211 | - $formatted = $this->format($name->given . " " . $name->family); |
|
211 | + $formatted = $this->format($name->given." ".$name->family); |
|
212 | 212 | $results[] = NameHelper::addExtendedMarkup($var, $name, $formatted); |
213 | 213 | } |
214 | 214 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | { |
238 | 238 | $this->label->setVariable($var); |
239 | 239 | if (in_array($this->label->getForm(), ["verb", "verb-short"])) { |
240 | - $name = $this->label->render($data) . $name; |
|
240 | + $name = $this->label->render($data).$name; |
|
241 | 241 | } else { |
242 | 242 | $name .= $this->label->render($data); |
243 | 243 | } |