Passed
Push — new-api ( 9a923b...62947e )
by Sebastian
04:28
created
src/Rendering/Layout.php 1 patch
Spacing   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -91,15 +91,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Rendering/Date/DateTime.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -133,8 +133,8 @@
 block discarded – undo
133 133
     public function renderNumeric()
134 134
     {
135 135
         $ret  = $this->year;
136
-        $ret .= $this->month > 0 && $this->month < 13 ? "-".sprintf("%02s", $this->month) : "";
137
-        $ret .= $this->day > 0 && $this->day < 32 ? "-".sprintf("%02s", $this->day) : "";
136
+        $ret .= $this->month > 0 && $this->month < 13 ? "-" . sprintf("%02s", $this->month) : "";
137
+        $ret .= $this->day > 0 && $this->day < 32 ? "-" . sprintf("%02s", $this->day) : "";
138 138
         return $ret;
139 139
     }
140 140
 }
Please login to merge, or discard this patch.
src/Rendering/Date/DateRange/YearMonthDayRenderer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
             } else {
37 37
                 $ret .= $datePart->render($from, $this->parentDateObject);
38 38
             }
39
-            ++$i;
39
+            ++ $i;
40 40
         }
41 41
         $ret .= $delimiter;
42 42
         $i = 0;
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
             } else {
49 49
                 $ret .= $datePart->render($to, $this->parentDateObject);
50 50
             }
51
-            ++$i;
51
+            ++ $i;
52 52
         }
53 53
         return $ret;
54 54
     }
Please login to merge, or discard this patch.
src/Rendering/Date/Date.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         foreach ($node->children() as $child) {
97 97
             if ($child->getName() === "date-part") {
98 98
                 $datePartName = (string) $child->attributes()["name"];
99
-                $this->dateParts->set($this->form."-".$datePartName, Util\Factory::create($child));
99
+                $this->dateParts->set($this->form . "-" . $datePartName, Util\Factory::create($child));
100 100
             }
101 101
         }
102 102
 
@@ -173,15 +173,15 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
                 }
Please login to merge, or discard this patch.
src/Rendering/Number/Number.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         }
100 100
         $number = $data->{$this->variable};
101 101
         $decimalNumber = $this->toDecimalNumber($number);
102
-        switch ((string)$this->form) {
102
+        switch ((string) $this->form) {
103 103
             case Form::ORDINAL:
104 104
                 if (preg_match(self::PATTERN_ORDINAL, $decimalNumber, $matches)) {
105 105
                     $num1 = $this->ordinal($matches[1]);
@@ -205,12 +205,12 @@  discard block
 block discarded – undo
205 205
     {
206 206
 
207 207
         if (self::RANGE_DELIMITER_AMPERSAND === $delimiter) {
208
-            $numRange = "$num1 ".htmlentities(self::RANGE_DELIMITER_AMPERSAND)." $num2";
208
+            $numRange = "$num1 " . htmlentities(self::RANGE_DELIMITER_AMPERSAND) . " $num2";
209 209
         } else {
210 210
             if (self::RANGE_DELIMITER_COMMA === $delimiter) {
211
-                $numRange = $num1.htmlentities(self::RANGE_DELIMITER_COMMA)." $num2";
211
+                $numRange = $num1 . htmlentities(self::RANGE_DELIMITER_COMMA) . " $num2";
212 212
             } else {
213
-                $numRange = $num1.self::RANGE_DELIMITER_HYPHEN.$num2;
213
+                $numRange = $num1 . self::RANGE_DELIMITER_HYPHEN . $num2;
214 214
             }
215 215
         }
216 216
         return $numRange;
Please login to merge, or discard this patch.
src/Rendering/Text/Text.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         $lang = (isset($data->language) && $data->language != 'en') ? $data->language : 'en';
137 137
         $this->stylesRenderer->getTextCase()->setLanguage($lang);
138 138
         $renderedText = "";
139
-        switch ((string)$this->renderType) {
139
+        switch ((string) $this->renderType) {
140 140
             case RenderType::VALUE:
141 141
                 $renderedText = $this->stylesRenderer->renderTextCase($this->renderObject);
142 142
                 break;
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
     private function normalizeDateRange($page)
229 229
     {
230 230
         if (preg_match("/^(\d+)\s?--?\s?(\d+)$/", trim($page), $matches)) {
231
-            return $matches[1]."-".$matches[2];
231
+            return $matches[1] . "-" . $matches[2];
232 232
         }
233 233
         return $page;
234 234
     }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
         }
274 274
         return $this->stylesRenderer->renderTextCase(
275 275
             StringHelper::clearApostrophes(
276
-                htmlspecialchars((string)$value, ENT_HTML5)
276
+                htmlspecialchars((string) $value, ENT_HTML5)
277 277
             )
278 278
         );
279 279
     }
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
      */
285 285
     private function formatRenderedText($renderedText)
286 286
     {
287
-        $text = $this->stylesRenderer->renderFormatting((string)$renderedText);
287
+        $text = $this->stylesRenderer->renderFormatting((string) $renderedText);
288 288
         $res = $this->stylesRenderer->renderAffixes($text);
289 289
         if (!empty($res)) {
290 290
             $res = $this->removeConsecutiveChars($res);
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
         $macro = $this->macros->get($this->renderObject);
315 315
         if (is_null($macro)) {
316 316
             try {
317
-                throw new CiteProcException("Macro \"".$this->renderObject."\" does not exist.");
317
+                throw new CiteProcException("Macro \"" . $this->renderObject . "\" does not exist.");
318 318
             } catch (CiteProcException $e) {
319 319
                 $renderedText = "";
320 320
             }
Please login to merge, or discard this patch.
src/Util/Renderer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
             throw new CiteProcException('No valid format for variable data. Either DataList or array expected');
36 36
         }
37 37
 
38
-        switch ((string)$mode) {
38
+        switch ((string) $mode) {
39 39
             case Config\RenderingMode::BIBLIOGRAPHY:
40 40
                 CiteProc::getContext()->setMode($mode);
41 41
                 // set CitationItems to Context
Please login to merge, or discard this patch.
src/Util/NameHelper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)
Please login to merge, or discard this patch.
src/Util/PageHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.