@@ -42,7 +42,7 @@ |
||
| 42 | 42 | if (empty($punctuationSign) || preg_match("/^\s+$/", $punctuationSign)) { |
| 43 | 43 | return $subject; |
| 44 | 44 | } |
| 45 | - $pattern = '/'.preg_quote(trim($punctuationSign), '/').'{2,}/'; |
|
| 45 | + $pattern = '/' . preg_quote(trim($punctuationSign), '/') . '{2,}/'; |
|
| 46 | 46 | if (preg_match($pattern, $subject)) { |
| 47 | 47 | return preg_replace($pattern, $punctuationSign, $subject); |
| 48 | 48 | } |
@@ -22,10 +22,10 @@ |
||
| 22 | 22 | $values = new ArrayList(); |
| 23 | 23 | return $values |
| 24 | 24 | ->setArray(Punctuation::toArray()) |
| 25 | - ->map(function (string $punctuation) { |
|
| 25 | + ->map(function(string $punctuation) { |
|
| 26 | 26 | return CiteProc::getContext()->getLocale()->filter("terms", $punctuation)->single; |
| 27 | 27 | }) |
| 28 | - ->collect(function ($items) { |
|
| 28 | + ->collect(function($items) { |
|
| 29 | 29 | return array_values($items); |
| 30 | 30 | }); |
| 31 | 31 | } |
@@ -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 | } |