@@ -123,7 +123,7 @@ |
||
| 123 | 123 | $this->parent = $parent; |
| 124 | 124 | /** |
| 125 | 125 | * @var SimpleXMLElement $child |
| 126 | - */ |
|
| 126 | + */ |
|
| 127 | 127 | foreach ($node->children() as $child) { |
| 128 | 128 | switch ($child->getName()) { |
| 129 | 129 | case "name": |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | } else { |
| 187 | 187 | $arr = []; |
| 188 | 188 | foreach ($data->editor as $editor) { |
| 189 | - $edt = $this->format($editor->family . ", " . $editor->given); |
|
| 189 | + $edt = $this->format($editor->family.", ".$editor->given); |
|
| 190 | 190 | $results[] = NameHelper::addExtendedMarkup('editor', $editor, $edt); |
| 191 | 191 | } |
| 192 | 192 | $str .= implode($this->delimiter, $arr); |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | $str .= $this->label->render($data); |
| 197 | 197 | } |
| 198 | 198 | $vars = $this->variables->toArray(); |
| 199 | - $vars = array_filter($vars, function ($value) { |
|
| 199 | + $vars = array_filter($vars, function($value) { |
|
| 200 | 200 | return !($value === "editor" || $value === "translator"); |
| 201 | 201 | }); |
| 202 | 202 | $this->variables->setArray($vars); |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | } |
| 221 | 221 | } else { |
| 222 | 222 | foreach ($data->{$var} as $name) { |
| 223 | - $formatted = $this->format($name->given . " " . $name->family); |
|
| 223 | + $formatted = $this->format($name->given." ".$name->family); |
|
| 224 | 224 | $results[] = NameHelper::addExtendedMarkup($var, $name, $formatted); |
| 225 | 225 | } |
| 226 | 226 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | { |
| 251 | 251 | $this->label->setVariable($var); |
| 252 | 252 | if (in_array($this->label->getForm(), ["verb", "verb-short"])) { |
| 253 | - $name = $this->label->render($data) . $name; |
|
| 253 | + $name = $this->label->render($data).$name; |
|
| 254 | 254 | } else { |
| 255 | 255 | $name .= $this->label->render($data); |
| 256 | 256 | } |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | |
| 378 | 378 | private function filterEmpty(array $results) |
| 379 | 379 | { |
| 380 | - return array_filter($results, function ($item) { |
|
| 380 | + return array_filter($results, function($item) { |
|
| 381 | 381 | return !empty($item); |
| 382 | 382 | }); |
| 383 | 383 | } |
@@ -90,13 +90,13 @@ |
||
| 90 | 90 | $this->nameParts = []; |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | - * @var SimpleXMLElement $child |
|
| 93 | + * @var SimpleXMLElement $child |
|
| 94 | 94 | */ |
| 95 | 95 | foreach ($node->children() as $child) { |
| 96 | 96 | switch ($child->getName()) { |
| 97 | 97 | case "name-part": |
| 98 | 98 | /** |
| 99 | - * @var NamePart $namePart |
|
| 99 | + * @var NamePart $namePart |
|
| 100 | 100 | */ |
| 101 | 101 | $namePart = Factory::create($child, $this); |
| 102 | 102 | $this->nameParts[$namePart->getName()] = $namePart; |
@@ -94,20 +94,20 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | foreach ($node->children() as $child) { |
| 96 | 96 | switch ($child->getName()) { |
| 97 | - case "name-part": |
|
| 98 | - /** |
|
| 97 | + case "name-part": |
|
| 98 | + /** |
|
| 99 | 99 | * @var NamePart $namePart |
| 100 | 100 | */ |
| 101 | - $namePart = Factory::create($child, $this); |
|
| 102 | - $this->nameParts[$namePart->getName()] = $namePart; |
|
| 101 | + $namePart = Factory::create($child, $this); |
|
| 102 | + $this->nameParts[$namePart->getName()] = $namePart; |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | foreach ($node->attributes() as $attribute) { |
| 107 | 107 | switch ($attribute->getName()) { |
| 108 | - case 'form': |
|
| 109 | - $this->form = (string)$attribute; |
|
| 110 | - break; |
|
| 108 | + case 'form': |
|
| 109 | + $this->form = (string)$attribute; |
|
| 110 | + break; |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | |
@@ -268,19 +268,19 @@ discard block |
||
| 268 | 268 | delimiter-precedes-et-al attribute. */ |
| 269 | 269 | |
| 270 | 270 | switch ($this->delimiterPrecedesEtAl) { |
| 271 | - case 'never': |
|
| 272 | - $text = $text . " " . $this->etAl; |
|
| 273 | - break; |
|
| 274 | - case 'always': |
|
| 275 | - $text = $text . $this->delimiter . $this->etAl; |
|
| 276 | - break; |
|
| 277 | - case 'contextual': |
|
| 278 | - default: |
|
| 279 | - if (count($resultNames) === 1) { |
|
| 280 | - $text .= " " . $this->etAl; |
|
| 281 | - } else { |
|
| 282 | - $text .= $this->delimiter . $this->etAl; |
|
| 283 | - } |
|
| 271 | + case 'never': |
|
| 272 | + $text = $text . " " . $this->etAl; |
|
| 273 | + break; |
|
| 274 | + case 'always': |
|
| 275 | + $text = $text . $this->delimiter . $this->etAl; |
|
| 276 | + break; |
|
| 277 | + case 'contextual': |
|
| 278 | + default: |
|
| 279 | + if (count($resultNames) === 1) { |
|
| 280 | + $text .= " " . $this->etAl; |
|
| 281 | + } else { |
|
| 282 | + $text .= $this->delimiter . $this->etAl; |
|
| 283 | + } |
|
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | return $text; |
@@ -352,40 +352,40 @@ discard block |
||
| 352 | 352 | /* “partial-each” - when one or more rendered names in the name variable match those in the preceding |
| 353 | 353 | bibliographic entry, the value of subsequent-author-substitute substitutes for each matching name. |
| 354 | 354 | Matching starts with the first name, and continues up to the first mismatch. */ |
| 355 | - case SubsequentAuthorSubstituteRule::PARTIAL_EACH: |
|
| 356 | - if (NameHelper::precedingHasAuthor($preceding, $name)) { |
|
| 357 | - $resultNames[] = $subsequentSubstitution; |
|
| 358 | - } else { |
|
| 359 | - $resultNames[] = $this->formatName($name, $rank); |
|
| 360 | - } |
|
| 361 | - break; |
|
| 362 | - /* “partial-first” - as “partial-each”, but substitution is limited to the first name of the name |
|
| 355 | + case SubsequentAuthorSubstituteRule::PARTIAL_EACH: |
|
| 356 | + if (NameHelper::precedingHasAuthor($preceding, $name)) { |
|
| 357 | + $resultNames[] = $subsequentSubstitution; |
|
| 358 | + } else { |
|
| 359 | + $resultNames[] = $this->formatName($name, $rank); |
|
| 360 | + } |
|
| 361 | + break; |
|
| 362 | + /* “partial-first” - as “partial-each”, but substitution is limited to the first name of the name |
|
| 363 | 363 | variable. */ |
| 364 | - case SubsequentAuthorSubstituteRule::PARTIAL_FIRST: |
|
| 365 | - if ($rank === 0) { |
|
| 366 | - if ($preceding->author[0]->family === $name->family) { |
|
| 367 | - $resultNames[] = $subsequentSubstitution; |
|
| 368 | - } else { |
|
| 369 | - $resultNames[] = $this->formatName($name, $rank); |
|
| 370 | - } |
|
| 371 | - } else { |
|
| 372 | - $resultNames[] = $this->formatName($name, $rank); |
|
| 373 | - } |
|
| 374 | - break; |
|
| 375 | - |
|
| 376 | - /* “complete-each” - requires a complete match like “complete-all”, but now the value of |
|
| 364 | + case SubsequentAuthorSubstituteRule::PARTIAL_FIRST: |
|
| 365 | + if ($rank === 0) { |
|
| 366 | + if ($preceding->author[0]->family === $name->family) { |
|
| 367 | + $resultNames[] = $subsequentSubstitution; |
|
| 368 | + } else { |
|
| 369 | + $resultNames[] = $this->formatName($name, $rank); |
|
| 370 | + } |
|
| 371 | + } else { |
|
| 372 | + $resultNames[] = $this->formatName($name, $rank); |
|
| 373 | + } |
|
| 374 | + break; |
|
| 375 | + |
|
| 376 | + /* “complete-each” - requires a complete match like “complete-all”, but now the value of |
|
| 377 | 377 | subsequent-author-substitute substitutes for each rendered name. */ |
| 378 | - case SubsequentAuthorSubstituteRule::COMPLETE_EACH: |
|
| 379 | - try { |
|
| 380 | - if (NameHelper::identicalAuthors($preceding, $data)) { |
|
| 381 | - $resultNames[] = $subsequentSubstitution; |
|
| 382 | - } else { |
|
| 383 | - $resultNames[] = $this->formatName($name, $rank); |
|
| 384 | - } |
|
| 385 | - } catch (CiteProcException $e) { |
|
| 386 | - $resultNames[] = $this->formatName($name, $rank); |
|
| 387 | - } |
|
| 388 | - break; |
|
| 378 | + case SubsequentAuthorSubstituteRule::COMPLETE_EACH: |
|
| 379 | + try { |
|
| 380 | + if (NameHelper::identicalAuthors($preceding, $data)) { |
|
| 381 | + $resultNames[] = $subsequentSubstitution; |
|
| 382 | + } else { |
|
| 383 | + $resultNames[] = $this->formatName($name, $rank); |
|
| 384 | + } |
|
| 385 | + } catch (CiteProcException $e) { |
|
| 386 | + $resultNames[] = $this->formatName($name, $rank); |
|
| 387 | + } |
|
| 388 | + break; |
|
| 389 | 389 | } |
| 390 | 390 | } |
| 391 | 391 | return $resultNames; |
@@ -502,18 +502,18 @@ discard block |
||
| 502 | 502 | $text = ""; |
| 503 | 503 | if (!empty($this->and) && empty($this->etAl)) { |
| 504 | 504 | switch ($this->delimiterPrecedesLast) { |
| 505 | - case 'after-inverted-name': |
|
| 506 | - //TODO: implement |
|
| 507 | - break; |
|
| 508 | - case 'always': |
|
| 509 | - $text = implode($this->delimiter, $resultNames); |
|
| 510 | - break; |
|
| 511 | - case 'never': |
|
| 512 | - $text = $this->renderDelimiterPrecedesLastNever($resultNames); |
|
| 513 | - break; |
|
| 514 | - case 'contextual': |
|
| 515 | - default: |
|
| 516 | - $text = $this->renderDelimiterPrecedesLastContextual($resultNames); |
|
| 505 | + case 'after-inverted-name': |
|
| 506 | + //TODO: implement |
|
| 507 | + break; |
|
| 508 | + case 'always': |
|
| 509 | + $text = implode($this->delimiter, $resultNames); |
|
| 510 | + break; |
|
| 511 | + case 'never': |
|
| 512 | + $text = $this->renderDelimiterPrecedesLastNever($resultNames); |
|
| 513 | + break; |
|
| 514 | + case 'contextual': |
|
| 515 | + default: |
|
| 516 | + $text = $this->renderDelimiterPrecedesLastContextual($resultNames); |
|
| 517 | 517 | } |
| 518 | 518 | } |
| 519 | 519 | return $text; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | foreach ($node->attributes() as $attribute) { |
| 107 | 107 | switch ($attribute->getName()) { |
| 108 | 108 | case 'form': |
| 109 | - $this->form = (string)$attribute; |
|
| 109 | + $this->form = (string) $attribute; |
|
| 110 | 110 | break; |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | cs:names element (taking into account the effects of et-al abbreviation and editor/translator collapsing), |
| 170 | 170 | which allows for advanced sorting. */ |
| 171 | 171 | if ($this->form == 'count') { |
| 172 | - return (int)count($resultNames); |
|
| 172 | + return (int) count($resultNames); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | return $text; |
@@ -269,17 +269,17 @@ discard block |
||
| 269 | 269 | |
| 270 | 270 | switch ($this->delimiterPrecedesEtAl) { |
| 271 | 271 | case 'never': |
| 272 | - $text = $text . " " . $this->etAl; |
|
| 272 | + $text = $text." ".$this->etAl; |
|
| 273 | 273 | break; |
| 274 | 274 | case 'always': |
| 275 | - $text = $text . $this->delimiter . $this->etAl; |
|
| 275 | + $text = $text.$this->delimiter.$this->etAl; |
|
| 276 | 276 | break; |
| 277 | 277 | case 'contextual': |
| 278 | 278 | default: |
| 279 | 279 | if (count($resultNames) === 1) { |
| 280 | - $text .= " " . $this->etAl; |
|
| 280 | + $text .= " ".$this->etAl; |
|
| 281 | 281 | } else { |
| 282 | - $text .= $this->delimiter . $this->etAl; |
|
| 282 | + $text .= $this->delimiter.$this->etAl; |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | } |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | $text = implode(" ", $resultNames); |
| 459 | 459 | } else { // >2 |
| 460 | 460 | $lastName = array_pop($resultNames); |
| 461 | - $text = implode($this->delimiter, $resultNames) . " " . $lastName; |
|
| 461 | + $text = implode($this->delimiter, $resultNames)." ".$lastName; |
|
| 462 | 462 | } |
| 463 | 463 | } |
| 464 | 464 | return $text; |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | { |
| 488 | 488 | $count = count($resultNames); |
| 489 | 489 | if (!empty($this->and) && $count > 1 && empty($this->etAl)) { |
| 490 | - $new = $this->and . ' ' . end($resultNames); // add and-prefix of the last name if "and" is defined |
|
| 490 | + $new = $this->and.' '.end($resultNames); // add and-prefix of the last name if "and" is defined |
|
| 491 | 491 | // set prefixed last name at the last position of $resultNames array |
| 492 | 492 | $resultNames[count($resultNames) - 1] = $new; |
| 493 | 493 | } |
@@ -535,8 +535,8 @@ discard block |
||
| 535 | 535 | if (StringHelper::isLatinString($normalizedName) || StringHelper::isCyrillicString($normalizedName)) { |
| 536 | 536 | if ($this->form === "long" |
| 537 | 537 | && $nameAsSortOrder |
| 538 | - && ((string)$demoteNonDroppingParticle === DemoteNonDroppingParticle::NEVER |
|
| 539 | - || (string)$demoteNonDroppingParticle === DemoteNonDroppingParticle::SORT_ONLY) |
|
| 538 | + && ((string) $demoteNonDroppingParticle === DemoteNonDroppingParticle::NEVER |
|
| 539 | + || (string) $demoteNonDroppingParticle === DemoteNonDroppingParticle::SORT_ONLY) |
|
| 540 | 540 | ) { |
| 541 | 541 | // [La] [Fontaine], [Jean] [de], [III] |
| 542 | 542 | NameHelper::prependParticleTo($data, "family", "non-dropping-particle"); |
@@ -544,25 +544,25 @@ discard block |
||
| 544 | 544 | |
| 545 | 545 | list($family, $given) = $this->renderNameParts($data); |
| 546 | 546 | |
| 547 | - $text = $family . (!empty($given) ? $this->sortSeparator . $given : ""); |
|
| 548 | - $text .= !empty($data->suffix) ? $this->sortSeparator . $data->suffix : ""; |
|
| 547 | + $text = $family.(!empty($given) ? $this->sortSeparator.$given : ""); |
|
| 548 | + $text .= !empty($data->suffix) ? $this->sortSeparator.$data->suffix : ""; |
|
| 549 | 549 | } elseif ($this->form === "long" |
| 550 | 550 | && $nameAsSortOrder |
| 551 | 551 | && (is_null($demoteNonDroppingParticle) |
| 552 | - || (string)$demoteNonDroppingParticle === DemoteNonDroppingParticle::DISPLAY_AND_SORT) |
|
| 552 | + || (string) $demoteNonDroppingParticle === DemoteNonDroppingParticle::DISPLAY_AND_SORT) |
|
| 553 | 553 | ) { |
| 554 | 554 | // [Fontaine], [Jean] [de] [La], [III] |
| 555 | 555 | NameHelper::appendParticleTo($data, "given", "dropping-particle"); |
| 556 | 556 | NameHelper::appendParticleTo($data, "given", "non-dropping-particle"); |
| 557 | 557 | list($family, $given) = $this->renderNameParts($data); |
| 558 | 558 | $text = $family; |
| 559 | - $text .= !empty($given) ? $this->sortSeparator . $given : ""; |
|
| 560 | - $text .= !empty($data->suffix) ? $this->sortSeparator . $data->suffix : ""; |
|
| 559 | + $text .= !empty($given) ? $this->sortSeparator.$given : ""; |
|
| 560 | + $text .= !empty($data->suffix) ? $this->sortSeparator.$data->suffix : ""; |
|
| 561 | 561 | } elseif ($this->form === "long" && $nameAsSortOrder && empty($demoteNonDroppingParticle)) { |
| 562 | 562 | list($family, $given) = $this->renderNameParts($data); |
| 563 | 563 | $text = $family; |
| 564 | - $text .= !empty($given) ? $this->delimiter . $given : ""; |
|
| 565 | - $text .= !empty($data->suffix) ? $this->sortSeparator . $data->suffix : ""; |
|
| 564 | + $text .= !empty($given) ? $this->delimiter.$given : ""; |
|
| 565 | + $text .= !empty($data->suffix) ? $this->sortSeparator.$data->suffix : ""; |
|
| 566 | 566 | } elseif ($this->form === "short") { |
| 567 | 567 | // [La] [Fontaine] |
| 568 | 568 | NameHelper::prependParticleTo($data, "family", "non-dropping-particle"); |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | NameHelper::prependParticleTo($data, "family", "dropping-particle"); |
| 574 | 574 | NameHelper::appendParticleTo($data, "family", "suffix"); |
| 575 | 575 | list($family, $given) = $this->renderNameParts($data); |
| 576 | - $text = !empty($given) ? $given . " " . $family : $family; |
|
| 576 | + $text = !empty($given) ? $given." ".$family : $family; |
|
| 577 | 577 | } |
| 578 | 578 | } else { |
| 579 | 579 | $text = $this->form === "long" ? $data->family.$data->given : $data->family; |
@@ -151,7 +151,7 @@ |
||
| 151 | 151 | public function flatten($array) |
| 152 | 152 | { |
| 153 | 153 | $returnArray = []; |
| 154 | - array_walk_recursive($array, function ($a) use (&$returnArray) { |
|
| 154 | + array_walk_recursive($array, function($a) use (&$returnArray) { |
|
| 155 | 155 | $returnArray[] = $a; |
| 156 | 156 | }); |
| 157 | 157 | return $returnArray; |
@@ -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,9 +111,9 @@ 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 | - return (bool)$ret; |
|
| 117 | + return (bool) $ret; |
|
| 118 | 118 | } |
| 119 | 119 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | public static function appendParticleTo(&$data, $namePart, $particle) |
| 71 | 71 | { |
| 72 | 72 | if (isset($data->{$particle}) && isset($data->{$namePart})) { |
| 73 | - $data->{$namePart} = $data->{$namePart} . " " . $data->{$particle}; // append $particle to $namePart |
|
| 73 | + $data->{$namePart} = $data->{$namePart}." ".$data->{$particle}; // append $particle to $namePart |
|
| 74 | 74 | unset($data->{$particle}); //remove particle from $data |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | public static function prependParticleTo(&$data, $namePart, $particle) |
| 85 | 85 | { |
| 86 | 86 | if (isset($data->{$particle}) && isset($data->{$namePart})) { |
| 87 | - $data->{$namePart} = $data->{$particle} . " " . $data->{$namePart}; //prepend $particle to $namePart |
|
| 87 | + $data->{$namePart} = $data->{$particle}." ".$data->{$namePart}; //prepend $particle to $namePart |
|
| 88 | 88 | unset($data->{$particle}); //remove particle from $data |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | return false; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - array_walk($persons1, function ($name, $key) use ($persons2, &$same) { |
|
| 105 | + array_walk($persons1, function($name, $key) use ($persons2, &$same) { |
|
| 106 | 106 | $family1 = $name->family; |
| 107 | 107 | $family2 = $persons2[$key]->family; |
| 108 | 108 | $same = $same && ($family1 === $family2); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | if (empty($data->family)) { |
| 122 | 122 | throw new CiteProcException("Illegal argument. Name has no family name."); |
| 123 | 123 | } |
| 124 | - return $data->family . (isset($data->given) ? $data->given : ""); |
|
| 124 | + return $data->family.(isset($data->given) ? $data->given : ""); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | public static function addExtendedMarkup($nameVar, $nameItem, $formattedName) |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | { |
| 80 | 80 | $wordArray = explode(" ", $text); |
| 81 | 81 | |
| 82 | - array_walk($wordArray, function (&$word) { |
|
| 82 | + array_walk($wordArray, function(&$word) { |
|
| 83 | 83 | $word = ucfirst($word); |
| 84 | 84 | }); |
| 85 | 85 | |
@@ -93,16 +93,16 @@ 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); |
| 100 | 100 | |
| 101 | - array_walk($wordArray, function (&$word) { |
|
| 101 | + array_walk($wordArray, function(&$word) { |
|
| 102 | 102 | |
| 103 | 103 | $words = explode("-", $word); |
| 104 | 104 | if (count($words) > 1) { |
| 105 | - array_walk($words, function (&$w) { |
|
| 105 | + array_walk($words, function(&$w) { |
|
| 106 | 106 | $w = StringHelper::keepLowerCase($w) ? $w : StringHelper::mb_ucfirst($w); |
| 107 | 107 | }); |
| 108 | 108 | $word = implode("-", $words); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | /** @noinspection PhpInternalEntityUsedInspection */ |
| 142 | 142 | $encoding = Mbstring::mb_detect_encoding($firstChar, self::ISO_ENCODINGS, true); |
| 143 | 143 | return in_array($encoding, self::ISO_ENCODINGS) ? |
| 144 | - Mbstring::mb_strtoupper($firstChar, $encoding) . $then : $firstChar . $then; |
|
| 144 | + Mbstring::mb_strtoupper($firstChar, $encoding).$then : $firstChar.$then; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | public static function mb_strrev($string) |
@@ -190,13 +190,13 @@ discard block |
||
| 190 | 190 | foreach ($spaceExploded as $givenPart) { |
| 191 | 191 | $firstLetter = mb_substr($givenPart, 0, 1, "UTF-8"); |
| 192 | 192 | if (StringHelper::isLatinString($firstLetter)) { |
| 193 | - $res .= ctype_upper($firstLetter) ? $firstLetter . $initializeSign : " " . $givenPart . " "; |
|
| 193 | + $res .= ctype_upper($firstLetter) ? $firstLetter.$initializeSign : " ".$givenPart." "; |
|
| 194 | 194 | } else { |
| 195 | - $res .= $firstLetter . $initializeSign; |
|
| 195 | + $res .= $firstLetter.$initializeSign; |
|
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | if ($i < count($exploded) - 1 && $initializeWithHyphen) { |
| 199 | - $res = rtrim($res) . "-"; |
|
| 199 | + $res = rtrim($res)."-"; |
|
| 200 | 200 | } |
| 201 | 201 | ++$i; |
| 202 | 202 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | $innerCloseQuote |
| 260 | 260 | ) { |
| 261 | 261 | if (preg_match("/(.*)$outerOpenQuote(.+)$outerCloseQuote(.*)/u", $text, $match)) { |
| 262 | - return $match[1] . $innerOpenQuote . $match[2] . $innerCloseQuote . $match[3]; |
|
| 262 | + return $match[1].$innerOpenQuote.$match[2].$innerCloseQuote.$match[3]; |
|
| 263 | 263 | } |
| 264 | 264 | return $text; |
| 265 | 265 | } |
@@ -290,6 +290,6 @@ discard block |
||
| 290 | 290 | */ |
| 291 | 291 | public static function removeBrackets($datePart) |
| 292 | 292 | { |
| 293 | - return str_replace(["[","]", "(", ")", "{", "}"], "", $datePart); |
|
| 293 | + return str_replace(["[", "]", "(", ")", "{", "}"], "", $datePart); |
|
| 294 | 294 | } |
| 295 | 295 | } |
@@ -26,103 +26,103 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | |
| 28 | 28 | const NAME_VARIABLES = [ |
| 29 | - 'author', // author |
|
| 30 | - 'collection-editor', // editor of the collection holding the item (e.g. the series editor for a book) |
|
| 31 | - 'composer', // composer (e.g. of a musical score) |
|
| 32 | - 'container-author', // author of the container holding the item (e.g. the book author for a book chapter) |
|
| 33 | - 'director', // director (e.g. of a film) |
|
| 34 | - 'editor', // editor |
|
| 35 | - 'editorial-director', // managing editor (“Directeur de la Publication” in French) |
|
| 36 | - 'illustrator', // illustrator (e.g. of a children’s book) |
|
| 37 | - 'interviewer', // interviewer (e.g. of an interview) |
|
| 38 | - 'original-author', // |
|
| 39 | - 'recipient', // recipient (e.g. of a letter) |
|
| 29 | + 'author', // author |
|
| 30 | + 'collection-editor', // editor of the collection holding the item (e.g. the series editor for a book) |
|
| 31 | + 'composer', // composer (e.g. of a musical score) |
|
| 32 | + 'container-author', // author of the container holding the item (e.g. the book author for a book chapter) |
|
| 33 | + 'director', // director (e.g. of a film) |
|
| 34 | + 'editor', // editor |
|
| 35 | + 'editorial-director', // managing editor (“Directeur de la Publication” in French) |
|
| 36 | + 'illustrator', // illustrator (e.g. of a children’s book) |
|
| 37 | + 'interviewer', // interviewer (e.g. of an interview) |
|
| 38 | + 'original-author', // |
|
| 39 | + 'recipient', // recipient (e.g. of a letter) |
|
| 40 | 40 | 'reviewed-author' // author of the item reviewed by the current item |
| 41 | 41 | ]; |
| 42 | 42 | |
| 43 | 43 | const NUMBER_VARIABLES = [ |
| 44 | - 'chapter-number', // chapter number |
|
| 45 | - 'collection-number', // number identifying the collection holding the item (e.g. the series number for a book) |
|
| 46 | - 'edition', // (container) edition holding the item (e.g. “3” when citing a chapter in the third |
|
| 44 | + 'chapter-number', // chapter number |
|
| 45 | + 'collection-number', // number identifying the collection holding the item (e.g. the series number for a book) |
|
| 46 | + 'edition', // (container) edition holding the item (e.g. “3” when citing a chapter in the third |
|
| 47 | 47 | // edition of a book) |
| 48 | - 'issue', // (container) issue holding the item (e.g. “5” when citing a journal article from |
|
| 48 | + 'issue', // (container) issue holding the item (e.g. “5” when citing a journal article from |
|
| 49 | 49 | // journal volume 2, issue 5) |
| 50 | - 'number', // number identifying the item (e.g. a report number) |
|
| 51 | - 'number-of-pages', // total number of pages of the cited item |
|
| 52 | - 'number-of-volumes', // total number of volumes, usable for citing multi-volume books and such |
|
| 50 | + 'number', // number identifying the item (e.g. a report number) |
|
| 51 | + 'number-of-pages', // total number of pages of the cited item |
|
| 52 | + 'number-of-volumes', // total number of volumes, usable for citing multi-volume books and such |
|
| 53 | 53 | 'volume' // (container) volume holding the item (e.g. “2” when citing a chapter from book volume 2) |
| 54 | 54 | ]; |
| 55 | 55 | |
| 56 | 56 | const DATE_VARIABLES = [ |
| 57 | - 'accessed', // date the item has been accessed |
|
| 57 | + 'accessed', // date the item has been accessed |
|
| 58 | 58 | 'container', |
| 59 | - 'event-date', // date the related event took place |
|
| 60 | - 'issued', // date the item was issued/published |
|
| 61 | - 'original-date', // (issue) date of the original version |
|
| 59 | + 'event-date', // date the related event took place |
|
| 60 | + 'issued', // date the item was issued/published |
|
| 61 | + 'original-date', // (issue) date of the original version |
|
| 62 | 62 | 'submitted' // date the item (e.g. a manuscript) has been submitted for publication |
| 63 | 63 | ]; |
| 64 | 64 | |
| 65 | 65 | const STANDARD_VARIABLE = [ |
| 66 | - 'abstract', //abstract of the item (e.g. the abstract of a journal article) |
|
| 67 | - 'annote', //reader’s notes about the item content |
|
| 68 | - 'archive', //archive storing the item |
|
| 69 | - 'archive-location', //storage location within an archive (e.g. a box and folder number) |
|
| 70 | - 'archive-place', //geographic location of the archive |
|
| 71 | - 'authority', //issuing or judicial authority (e.g. “USPTO” for a patent, “Fairfax Circuit Court” for |
|
| 66 | + 'abstract', //abstract of the item (e.g. the abstract of a journal article) |
|
| 67 | + 'annote', //reader’s notes about the item content |
|
| 68 | + 'archive', //archive storing the item |
|
| 69 | + 'archive-location', //storage location within an archive (e.g. a box and folder number) |
|
| 70 | + 'archive-place', //geographic location of the archive |
|
| 71 | + 'authority', //issuing or judicial authority (e.g. “USPTO” for a patent, “Fairfax Circuit Court” for |
|
| 72 | 72 | //a legal case) |
| 73 | - 'call-number', //call number (to locate the item in a library) |
|
| 74 | - 'citation-label', //label identifying the item in in-text citations of label styles (e.g. “Ferr78”). May |
|
| 73 | + 'call-number', //call number (to locate the item in a library) |
|
| 74 | + 'citation-label', //label identifying the item in in-text citations of label styles (e.g. “Ferr78”). May |
|
| 75 | 75 | //be assigned by the CSL processor based on item metadata. |
| 76 | - 'citation-number', //index (starting at 1) of the cited reference in the bibliography (generated by the CSL |
|
| 76 | + 'citation-number', //index (starting at 1) of the cited reference in the bibliography (generated by the CSL |
|
| 77 | 77 | //processor) |
| 78 | - 'collection-title', //title of the collection holding the item (e.g. the series title for a book) |
|
| 79 | - 'container-title', //title of the container holding the item (e.g. the book title for a book chapter, the |
|
| 78 | + 'collection-title', //title of the collection holding the item (e.g. the series title for a book) |
|
| 79 | + 'container-title', //title of the container holding the item (e.g. the book title for a book chapter, the |
|
| 80 | 80 | //journal title for a journal article) |
| 81 | - 'container-title-short',//short/abbreviated form of “container-title” (also accessible through the “short” form |
|
| 81 | + 'container-title-short', //short/abbreviated form of “container-title” (also accessible through the “short” form |
|
| 82 | 82 | //of the “container-title” variable) |
| 83 | - 'dimensions', //physical (e.g. size) or temporal (e.g. running time) dimensions of the item |
|
| 84 | - 'DOI', //Digital Object Identifier (e.g. “10.1128/AEM.02591-07”) |
|
| 85 | - 'event', //name of the related event (e.g. the conference name when citing a conference paper) |
|
| 86 | - 'event-place', //geographic location of the related event (e.g. “Amsterdam, the Netherlands”) |
|
| 83 | + 'dimensions', //physical (e.g. size) or temporal (e.g. running time) dimensions of the item |
|
| 84 | + 'DOI', //Digital Object Identifier (e.g. “10.1128/AEM.02591-07”) |
|
| 85 | + 'event', //name of the related event (e.g. the conference name when citing a conference paper) |
|
| 86 | + 'event-place', //geographic location of the related event (e.g. “Amsterdam, the Netherlands”) |
|
| 87 | 87 | 'first-reference-note-number', //number of a preceding note containing the first reference to the item. Assigned |
| 88 | 88 | // by the CSL processor. The variable holds no value for non-note-based styles, or when |
| 89 | 89 | // the item hasn’t been cited in any preceding notes. |
| 90 | - 'genre', //class, type or genre of the item (e.g. “adventure” for an adventure movie, |
|
| 90 | + 'genre', //class, type or genre of the item (e.g. “adventure” for an adventure movie, |
|
| 91 | 91 | //“PhD dissertation” for a PhD thesis), |
| 92 | - 'ISBN', //International Standard Book Number |
|
| 93 | - 'ISSN', //International Standard Serial Number |
|
| 94 | - 'jurisdiction', //geographic scope of relevance (e.g. “US” for a US patent) |
|
| 95 | - 'keyword', //keyword(s) or tag(s) attached to the item |
|
| 96 | - 'locator', //a cite-specific pinpointer within the item (e.g. a page number within a book, or a |
|
| 92 | + 'ISBN', //International Standard Book Number |
|
| 93 | + 'ISSN', //International Standard Serial Number |
|
| 94 | + 'jurisdiction', //geographic scope of relevance (e.g. “US” for a US patent) |
|
| 95 | + 'keyword', //keyword(s) or tag(s) attached to the item |
|
| 96 | + 'locator', //a cite-specific pinpointer within the item (e.g. a page number within a book, or a |
|
| 97 | 97 | //volume in a multi-volume work). Must be accompanied in the input data by a label |
| 98 | 98 | //indicating the locator type (see the Locators term list), which determines which term |
| 99 | 99 | //is rendered by cs:label when the “locator” variable is selected. |
| 100 | - 'medium', //medium description (e.g. “CD”, “DVD”, etc.) |
|
| 101 | - 'note', //(short) inline note giving additional item details (e.g. a concise summary or commentary) |
|
| 102 | - 'original-publisher', //original publisher, for items that have been republished by a different publisher |
|
| 100 | + 'medium', //medium description (e.g. “CD”, “DVD”, etc.) |
|
| 101 | + 'note', //(short) inline note giving additional item details (e.g. a concise summary or commentary) |
|
| 102 | + 'original-publisher', //original publisher, for items that have been republished by a different publisher |
|
| 103 | 103 | 'original-publisher-place', //geographic location of the original publisher (e.g. “London, UK”) |
| 104 | - 'original-title', //title of the original version (e.g. “Война и мир”, the untranslated Russian title of |
|
| 104 | + 'original-title', //title of the original version (e.g. “Война и мир”, the untranslated Russian title of |
|
| 105 | 105 | // “War and Peace”) |
| 106 | - 'page', //range of pages the item (e.g. a journal article) covers in a container (e.g. a journal |
|
| 106 | + 'page', //range of pages the item (e.g. a journal article) covers in a container (e.g. a journal |
|
| 107 | 107 | // issue) |
| 108 | - 'page-first', //first page of the range of pages the item (e.g. a journal article) covers in a |
|
| 108 | + 'page-first', //first page of the range of pages the item (e.g. a journal article) covers in a |
|
| 109 | 109 | //container (e.g. a journal issue) |
| 110 | - 'PMCID', //PubMed Central reference number |
|
| 111 | - 'PMID', //PubMed reference number |
|
| 112 | - 'publisher', //publisher |
|
| 113 | - 'publisher-place', //geographic location of the publisher |
|
| 114 | - 'references', //resources related to the procedural history of a legal case |
|
| 115 | - 'reviewed-title', //title of the item reviewed by the current item |
|
| 116 | - 'scale', //scale of e.g. a map |
|
| 117 | - 'section', //container section holding the item (e.g. “politics” for a newspaper article) |
|
| 118 | - 'source', //from whence the item originates (e.g. a library catalog or database) |
|
| 119 | - 'status', //(publication) status of the item (e.g. “forthcoming”) |
|
| 120 | - 'title', //primary title of the item |
|
| 121 | - 'title-short', //short/abbreviated form of “title” (also accessible through the “short” form of the |
|
| 110 | + 'PMCID', //PubMed Central reference number |
|
| 111 | + 'PMID', //PubMed reference number |
|
| 112 | + 'publisher', //publisher |
|
| 113 | + 'publisher-place', //geographic location of the publisher |
|
| 114 | + 'references', //resources related to the procedural history of a legal case |
|
| 115 | + 'reviewed-title', //title of the item reviewed by the current item |
|
| 116 | + 'scale', //scale of e.g. a map |
|
| 117 | + 'section', //container section holding the item (e.g. “politics” for a newspaper article) |
|
| 118 | + 'source', //from whence the item originates (e.g. a library catalog or database) |
|
| 119 | + 'status', //(publication) status of the item (e.g. “forthcoming”) |
|
| 120 | + 'title', //primary title of the item |
|
| 121 | + 'title-short', //short/abbreviated form of “title” (also accessible through the “short” form of the |
|
| 122 | 122 | //“title” variable) |
| 123 | - 'URL', //Uniform Resource Locator (e.g. “http://aem.asm.org/cgi/content/full/74/9/2766”) |
|
| 124 | - 'version', //version of the item (e.g. “2.0.9” for a software program) |
|
| 125 | - 'year-suffix', //disambiguating year suffix in author-date styles (e.g. “a” in “Doe, 1999a”) |
|
| 123 | + 'URL', //Uniform Resource Locator (e.g. “http://aem.asm.org/cgi/content/full/74/9/2766”) |
|
| 124 | + 'version', //version of the item (e.g. “2.0.9” for a software program) |
|
| 125 | + 'year-suffix', //disambiguating year suffix in author-date styles (e.g. “a” in “Doe, 1999a”) |
|
| 126 | 126 | |
| 127 | 127 | |
| 128 | 128 | ]; |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $parent = null; |
| 170 | 170 | $names = new Names( |
| 171 | 171 | new SimpleXMLElement( |
| 172 | - "<names variable=\"$variable\" delimiter=\"-\">" . |
|
| 172 | + "<names variable=\"$variable\" delimiter=\"-\">". |
|
| 173 | 173 | "<name form=\"long\" sort-separator=\",\" name-as-sort-order=\"all\"/></names>" |
| 174 | 174 | ), |
| 175 | 175 | $parent |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | $digitFrom = $from[$i]; |
| 69 | 69 | if ($digitTo !== $digitFrom) { |
| 70 | - $resTo = $digitTo . $resTo; |
|
| 70 | + $resTo = $digitTo.$resTo; |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | return $resTo; |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | private static function renderChicago($from, $to) |
| 79 | 79 | { |
| 80 | 80 | if ($from > 100 && ($from % 100 > 0) && intval(($from / 100), 10) === intval(($to / 100), 10)) { |
| 81 | - return "" . ($to % 100); |
|
| 81 | + return "".($to % 100); |
|
| 82 | 82 | } elseif ($from >= 10000) { |
| 83 | - return "" . ($to % 1000); |
|
| 83 | + return "".($to % 1000); |
|
| 84 | 84 | } |
| 85 | 85 | return $to; |
| 86 | 86 | } |
@@ -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) { |