@@ -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 | } |
@@ -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 | } elseif (!empty($this->datePartsAttribute)) { |
| 197 | 197 | // fallback: |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | if (!empty($dateFromLocale)) { |
| 275 | 275 | $dateForm = array_filter( |
| 276 | 276 | is_array($dateFromLocale) ? $dateFromLocale : [$dateFromLocale], |
| 277 | - function ($element) use ($format) { |
|
| 277 | + function($element) use ($format) { |
|
| 278 | 278 | /** @var SimpleXMLElement $element */ |
| 279 | 279 | $dateForm = (string) $element->attributes()["form"]; |
| 280 | 280 | return $dateForm === $format; |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | if ($this->dateParts->count() < 1 && in_array($form, self::$localizedDateFormats)) { |
| 337 | 337 | if ($this->hasDatePartsFromLocales($form)) { |
| 338 | 338 | $datePartsFromLocales = $this->getDatePartsFromLocales($form); |
| 339 | - array_filter($datePartsFromLocales, function (SimpleXMLElement $item) use ($dateParts) { |
|
| 339 | + array_filter($datePartsFromLocales, function(SimpleXMLElement $item) use ($dateParts) { |
|
| 340 | 340 | return in_array($item["name"], $dateParts); |
| 341 | 341 | }); |
| 342 | 342 | |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | $this->dateParts->add( |
| 350 | 350 | "$form-$datePart", |
| 351 | 351 | new DatePart( |
| 352 | - new SimpleXMLElement('<date-part name="'.$datePart.'" form="'.$form.'" />') |
|
| 352 | + new SimpleXMLElement('<date-part name="' . $datePart . '" form="' . $form . '" />') |
|
| 353 | 353 | ) |
| 354 | 354 | ); |
| 355 | 355 | } |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | */ |
| 405 | 405 | private function datePartsHaveAffixes() |
| 406 | 406 | { |
| 407 | - $result = $this->dateParts->filter(function (DatePart $datePart) { |
|
| 407 | + $result = $this->dateParts->filter(function(DatePart $datePart) { |
|
| 408 | 408 | return $datePart->renderSuffix() !== "" || $datePart->renderPrefix() !== ""; |
| 409 | 409 | }); |
| 410 | 410 | return $result->count() > 0; |
@@ -91,15 +91,14 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | if (CiteProc::getContext()->isModeBibliography()) { |
| 94 | - foreach ($data as $citationNumber => $item) { |
|
| 95 | - ++self::$numberOfCitedItems; |
|
| 94 | + foreach ($data as $citationNumber => $item) {++self::$numberOfCitedItems; |
|
| 96 | 95 | CiteProc::getContext()->getResults()->append( |
| 97 | 96 | $this->wrapBibEntry($item, $this->renderSingle($item, $citationNumber)) |
| 98 | 97 | ); |
| 99 | 98 | } |
| 100 | 99 | $ret .= implode($this->delimiter, CiteProc::getContext()->getResults()->toArray()); |
| 101 | 100 | $ret = StringHelper::clearApostrophes($ret); |
| 102 | - return "<div class=\"csl-bib-body\">".$ret."\n</div>"; |
|
| 101 | + return "<div class=\"csl-bib-body\">" . $ret . "\n</div>"; |
|
| 103 | 102 | } elseif (CiteProc::getContext()->isModeCitation()) { |
| 104 | 103 | if ($citationItems->count() > 0) { //is there a filter for specific citations? |
| 105 | 104 | if ($this->isGroupedCitations($citationItems)) { //if citation items grouped? |
@@ -146,7 +145,7 @@ discard block |
||
| 146 | 145 | if (!empty($inMargin) && !empty($margin) && CiteProc::getContext()->isModeBibliography()) { |
| 147 | 146 | $leftMargin = $this->removeConsecutiveChars($this->htmlentities($this->format(implode("", $inMargin)))); |
| 148 | 147 | $rightInline = $this->removeConsecutiveChars( |
| 149 | - $this->htmlentities($this->format(implode("", $margin))). |
|
| 148 | + $this->htmlentities($this->format(implode("", $margin))) . |
|
| 150 | 149 | $this->suffix |
| 151 | 150 | ); |
| 152 | 151 | $res = '<div class="csl-left-margin">' . trim($leftMargin) . '</div>'; |
@@ -175,7 +174,7 @@ discard block |
||
| 175 | 174 | private function wrapBibEntry($dataItem, $value) |
| 176 | 175 | { |
| 177 | 176 | $value = $this->addAffixes($value); |
| 178 | - return "\n ". |
|
| 177 | + return "\n " . |
|
| 179 | 178 | "<div class=\"csl-entry\">" . |
| 180 | 179 | $renderedItem = CiteProcHelper::applyAdditionMarkupFunction($dataItem, "csl-entry", $value) . |
| 181 | 180 | "</div>"; |
@@ -218,7 +217,7 @@ discard block |
||
| 218 | 217 | { |
| 219 | 218 | $arr = $data->toArray(); |
| 220 | 219 | |
| 221 | - $arr_ = array_filter($arr, function ($dataItem) use ($citationItems) { |
|
| 220 | + $arr_ = array_filter($arr, function($dataItem) use ($citationItems) { |
|
| 222 | 221 | foreach ($citationItems as $citationItem) { |
| 223 | 222 | if ($dataItem->id === $citationItem->id) { |
| 224 | 223 | return true; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | private function normalizeDateRange($page) |
| 189 | 189 | { |
| 190 | 190 | if (preg_match("/^(\d+)\s?--?\s?(\d+)$/", trim($page), $matches)) { |
| 191 | - return $matches[1]."-".$matches[2]; |
|
| 191 | + return $matches[1] . "-" . $matches[2]; |
|
| 192 | 192 | } |
| 193 | 193 | return $page; |
| 194 | 194 | } |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | $macro = CiteProc::getContext()->getMacro($this->toRenderTypeValue); |
| 283 | 283 | if (is_null($macro)) { |
| 284 | 284 | try { |
| 285 | - throw new CiteProcException("Macro \"".$this->toRenderTypeValue."\" does not exist."); |
|
| 285 | + throw new CiteProcException("Macro \"" . $this->toRenderTypeValue . "\" does not exist."); |
|
| 286 | 286 | } catch (CiteProcException $e) { |
| 287 | 287 | $renderedText = ""; |
| 288 | 288 | } |