@@ -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) { |
@@ -52,7 +52,7 @@ |
||
52 | 52 | */ |
53 | 53 | public static function getCompareNumber() |
54 | 54 | { |
55 | - return function ($numA, $numB, $order) { |
|
55 | + return function($numA, $numB, $order) { |
|
56 | 56 | if (is_numeric($numA) && is_numeric($numB)) { |
57 | 57 | $ret = $numA - $numB; |
58 | 58 | } else { |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | private function matchAny(stdClass $data): bool |
64 | 64 | { |
65 | 65 | return $this->conditionVariables |
66 | - ->map(function (string $conditionVariable) use ($data) { |
|
66 | + ->map(function(string $conditionVariable) use ($data) { |
|
67 | 67 | return $this->matchForVariable($conditionVariable, $data); |
68 | 68 | }) |
69 | - ->filter(function (bool $match) { |
|
69 | + ->filter(function(bool $match) { |
|
70 | 70 | return $match === true; |
71 | 71 | }) |
72 | 72 | ->count() > 0; |
@@ -75,10 +75,10 @@ discard block |
||
75 | 75 | private function matchAll(stdClass $data): bool |
76 | 76 | { |
77 | 77 | return $this->conditionVariables |
78 | - ->map(function (string $conditionVariable) use ($data) { |
|
78 | + ->map(function(string $conditionVariable) use ($data) { |
|
79 | 79 | return $this->matchForVariable($conditionVariable, $data); |
80 | 80 | }) |
81 | - ->filter(function (bool $match) { |
|
81 | + ->filter(function(bool $match) { |
|
82 | 82 | return $match === true; |
83 | 83 | }) |
84 | 84 | ->count() === $this->conditionVariables->count(); |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | private function matchNone(stdClass $data): bool |
88 | 88 | { |
89 | 89 | return $this->conditionVariables |
90 | - ->map(function (string $conditionVariable) use ($data) { |
|
90 | + ->map(function(string $conditionVariable) use ($data) { |
|
91 | 91 | return $this->matchForVariable($conditionVariable, $data); |
92 | 92 | }) |
93 | - ->filter(function (bool $match) { |
|
93 | + ->filter(function(bool $match) { |
|
94 | 94 | return $match === false; |
95 | 95 | }) |
96 | 96 | ->count() === $this->conditionVariables->count(); |
@@ -23,8 +23,8 @@ |
||
23 | 23 | public static function createConstraint(string $name, string $value, string $match): Constraint |
24 | 24 | { |
25 | 25 | $parts = explode("-", $name); |
26 | - $className = implode("", array_map(function ($part) { |
|
27 | - return ucfirst($part);//overridden function |
|
26 | + $className = implode("", array_map(function($part) { |
|
27 | + return ucfirst($part); //overridden function |
|
28 | 28 | }, $parts)); |
29 | 29 | $className = self::NAMESPACE_CONSTRAINTS . $className; |
30 | 30 |
@@ -105,28 +105,28 @@ |
||
105 | 105 | switch ($this->match) { |
106 | 106 | case Constraint::MATCH_ANY: |
107 | 107 | return $this->constraints |
108 | - ->map(function (Constraint $constraint) use ($data) { |
|
108 | + ->map(function(Constraint $constraint) use ($data) { |
|
109 | 109 | return $constraint->validate($data); |
110 | 110 | }) |
111 | - ->filter(function (bool $match) { |
|
111 | + ->filter(function(bool $match) { |
|
112 | 112 | return $match === true; |
113 | 113 | }) |
114 | 114 | ->count() > 0; |
115 | 115 | case Constraint::MATCH_ALL: |
116 | 116 | return $this->constraints |
117 | - ->map(function (Constraint $constraint) use ($data) { |
|
117 | + ->map(function(Constraint $constraint) use ($data) { |
|
118 | 118 | return $constraint->validate($data); |
119 | 119 | }) |
120 | - ->filter(function (bool $match) { |
|
120 | + ->filter(function(bool $match) { |
|
121 | 121 | return $match === true; |
122 | 122 | }) |
123 | 123 | ->count() === $this->constraints->count(); |
124 | 124 | case Constraint::MATCH_NONE: |
125 | 125 | return !$this->constraints |
126 | - ->map(function (Constraint $constraint) use ($data) { |
|
126 | + ->map(function(Constraint $constraint) use ($data) { |
|
127 | 127 | return $constraint->validate($data); |
128 | 128 | }) |
129 | - ->filter(function (bool $match) { |
|
129 | + ->filter(function(bool $match) { |
|
130 | 130 | return $match === false; |
131 | 131 | }) |
132 | 132 | ->count() === $this->constraints->count(); |
@@ -83,10 +83,10 @@ |
||
83 | 83 | $result->append($ifCondition->render($data)); |
84 | 84 | } elseif ($this->children->hasKey("elseif")) { // ELSEIF |
85 | 85 | $elseIfs = $this->children->get("elseif") |
86 | - ->map(function (ChooseIf $elseIf) use ($data) { |
|
86 | + ->map(function(ChooseIf $elseIf) use ($data) { |
|
87 | 87 | return new Tuple($elseIf, $elseIf->match($data)); |
88 | 88 | }) |
89 | - ->filter(function (Tuple $elseIfToMatch) { |
|
89 | + ->filter(function(Tuple $elseIfToMatch) { |
|
90 | 90 | return $elseIfToMatch->second === true; |
91 | 91 | }); |
92 | 92 | $matchedIfs = $elseIfs->count() > 0; |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | public static function longOrdinal($num) |
176 | 176 | { |
177 | 177 | $num = sprintf("%02d", $num); |
178 | - $ret = CiteProc::getContext()->getLocale()->filter('terms', 'long-ordinal-'.$num)->single; |
|
178 | + $ret = CiteProc::getContext()->getLocale()->filter('terms', 'long-ordinal-' . $num)->single; |
|
179 | 179 | if (!$ret) { |
180 | 180 | return self::ordinal($num); |
181 | 181 | } |
@@ -192,12 +192,12 @@ discard block |
||
192 | 192 | { |
193 | 193 | |
194 | 194 | if (self::RANGE_DELIMITER_AMPERSAND === $delim) { |
195 | - $numRange = "$num1 ".htmlentities(self::RANGE_DELIMITER_AMPERSAND)." $num2"; |
|
195 | + $numRange = "$num1 " . htmlentities(self::RANGE_DELIMITER_AMPERSAND) . " $num2"; |
|
196 | 196 | } else { |
197 | 197 | if (self::RANGE_DELIMITER_COMMA === $delim) { |
198 | - $numRange = $num1.htmlentities(self::RANGE_DELIMITER_COMMA)." $num2"; |
|
198 | + $numRange = $num1 . htmlentities(self::RANGE_DELIMITER_COMMA) . " $num2"; |
|
199 | 199 | } else { |
200 | - $numRange = $num1.self::RANGE_DELIMITER_HYPHEN.$num2; |
|
200 | + $numRange = $num1 . self::RANGE_DELIMITER_HYPHEN . $num2; |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 | return $numRange; |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | } else { |
197 | 197 | $arr = []; |
198 | 198 | foreach ($data->editor as $editor) { |
199 | - $edt = $this->format($editor->family.", ".$editor->given); |
|
199 | + $edt = $this->format($editor->family . ", " . $editor->given); |
|
200 | 200 | $results[] = NameHelper::addExtendedMarkup('editor', $editor, $edt); |
201 | 201 | } |
202 | 202 | $str .= implode($this->delimiter, $arr); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $str .= $this->label->render($data); |
207 | 207 | } |
208 | 208 | $vars = $this->variables->toArray(); |
209 | - $vars = array_filter($vars, function ($value) { |
|
209 | + $vars = array_filter($vars, function($value) { |
|
210 | 210 | return !($value === "editor" || $value === "translator"); |
211 | 211 | }); |
212 | 212 | $this->variables->setArray($vars); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | } |
231 | 231 | } else { |
232 | 232 | foreach ($data->{$var} as $name) { |
233 | - $formatted = $this->format($name->given." ".$name->family); |
|
233 | + $formatted = $this->format($name->given . " " . $name->family); |
|
234 | 234 | $results[] = NameHelper::addExtendedMarkup($var, $name, $formatted); |
235 | 235 | } |
236 | 236 | } |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | |
400 | 400 | private function filterEmpty(array $results) |
401 | 401 | { |
402 | - return array_filter($results, function ($item) { |
|
402 | + return array_filter($results, function($item) { |
|
403 | 403 | return !empty($item); |
404 | 404 | }); |
405 | 405 | } |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | $text = implode(" ", $resultNames); |
457 | 457 | } else { // >2 |
458 | 458 | $lastName = array_pop($resultNames); |
459 | - $text = implode($this->delimiter, $resultNames)." ".$lastName; |
|
459 | + $text = implode($this->delimiter, $resultNames) . " " . $lastName; |
|
460 | 460 | } |
461 | 461 | } |
462 | 462 | return $text; |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | { |
486 | 486 | $count = count($resultNames); |
487 | 487 | if (!empty($this->and) && $count > 1 && empty($this->etAl)) { |
488 | - $new = $this->and.' '.end($resultNames); // add and-prefix of the last name if "and" is defined |
|
488 | + $new = $this->and . ' ' . end($resultNames); // add and-prefix of the last name if "and" is defined |
|
489 | 489 | // set prefixed last name at the last position of $resultNames array |
490 | 490 | $resultNames[count($resultNames) - 1] = $new; |
491 | 491 | } |
@@ -542,8 +542,8 @@ discard block |
||
542 | 542 | |
543 | 543 | list($family, $given) = $this->renderNameParts($data); |
544 | 544 | |
545 | - $text = $family.(!empty($given) ? $this->sortSeparator.$given : ""); |
|
546 | - $text .= !empty($data->suffix) ? $this->sortSeparator.$data->suffix : ""; |
|
545 | + $text = $family . (!empty($given) ? $this->sortSeparator . $given : ""); |
|
546 | + $text .= !empty($data->suffix) ? $this->sortSeparator . $data->suffix : ""; |
|
547 | 547 | } elseif ($this->form === "long" |
548 | 548 | && $nameAsSortOrder |
549 | 549 | && (is_null($demoteNonDroppingParticle) |
@@ -554,13 +554,13 @@ discard block |
||
554 | 554 | NameHelper::appendParticleTo($data, "given", "non-dropping-particle"); |
555 | 555 | list($family, $given) = $this->renderNameParts($data); |
556 | 556 | $text = $family; |
557 | - $text .= !empty($given) ? $this->sortSeparator.$given : ""; |
|
558 | - $text .= !empty($data->suffix) ? $this->sortSeparator.$data->suffix : ""; |
|
557 | + $text .= !empty($given) ? $this->sortSeparator . $given : ""; |
|
558 | + $text .= !empty($data->suffix) ? $this->sortSeparator . $data->suffix : ""; |
|
559 | 559 | } elseif ($this->form === "long" && $nameAsSortOrder && empty($demoteNonDroppingParticle)) { |
560 | 560 | list($family, $given) = $this->renderNameParts($data); |
561 | 561 | $text = $family; |
562 | - $text .= !empty($given) ? $this->delimiter.$given : ""; |
|
563 | - $text .= !empty($data->suffix) ? $this->sortSeparator.$data->suffix : ""; |
|
562 | + $text .= !empty($given) ? $this->delimiter . $given : ""; |
|
563 | + $text .= !empty($data->suffix) ? $this->sortSeparator . $data->suffix : ""; |
|
564 | 564 | } elseif ($this->form === "short") { |
565 | 565 | // [La] [Fontaine] |
566 | 566 | NameHelper::prependParticleTo($data, "family", "non-dropping-particle"); |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | NameHelper::prependParticleTo($data, "family", "dropping-particle"); |
572 | 572 | NameHelper::appendParticleTo($data, "family", "suffix"); |
573 | 573 | list($family, $given) = $this->renderNameParts($data); |
574 | - $text = !empty($given) ? $given." ".$family : $family; |
|
574 | + $text = !empty($given) ? $given . " " . $family : $family; |
|
575 | 575 | } |
576 | 576 | } elseif (StringHelper::isAsianString(NameHelper::normalizeName($data))) { |
577 | 577 | $text = $this->form === "long" ? $data->family . $data->given : $data->family; |