Test Failed
Push — master ( 17b449...5bba69 )
by Sebastian
02:49
created
src/Seboettg/CiteProc/CiteProc.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     }
116 116
 
117 117
     /**
118
-     * @param array|DataList $data
118
+     * @param DataList $data
119 119
      * @return string
120 120
      */
121 121
     protected function bibliography($data)
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     }
126 126
 
127 127
     /**
128
-     * @param array|DataList $data
128
+     * @param DataList $data
129 129
      * @return string
130 130
      */
131 131
     protected function citation($data)
Please login to merge, or discard this patch.
src/Seboettg/CiteProc/Rendering/Date/Date.php 2 patches
Doc Comments   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     }
255 255
 
256 256
     /**
257
-     * @param $differentParts
257
+     * @param integer $differentParts
258 258
      * @param DateTime $from
259 259
      * @param DateTime $to
260 260
      * @param $delim
@@ -406,8 +406,8 @@  discard block
 block discarded – undo
406 406
 
407 407
     /**
408 408
      * @param $datePart
409
-     * @param $from
410
-     * @param $to
409
+     * @param DateTime $from
410
+     * @param DateTime $to
411 411
      * @param $delim
412 412
      * @return string
413 413
      */
@@ -421,6 +421,7 @@  discard block
 block discarded – undo
421 421
     }
422 422
 
423 423
     /**
424
+     * @param string $format
424 425
      * @return bool
425 426
      */
426 427
     private function hasDatePartsFromLocales($format)
@@ -430,6 +431,7 @@  discard block
 block discarded – undo
430 431
     }
431 432
 
432 433
     /**
434
+     * @param string $format
433 435
      * @return array
434 436
      */
435 437
     private function getDatePartsFromLocales($format)
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         if ($this->dateParts->count() < 1 && in_array($form, self::$localizedDateFormats)) {
143 143
             if ($this->hasDatePartsFromLocales($form)) {
144 144
                 $datePartsFromLocales = $this->getDatePartsFromLocales($form);
145
-                array_filter($datePartsFromLocales, function (\SimpleXMLElement $item) use ($dateParts) {
145
+                array_filter($datePartsFromLocales, function(\SimpleXMLElement $item) use ($dateParts) {
146 146
                     return in_array($item["name"], $dateParts);
147 147
                 });
148 148
 
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
                 $ret = $this->renderDateRange($toRender, $from, $to, $delim);
213 213
             }
214 214
 
215
-            if (isset($var->raw) && preg_match("/(\p{L}+)\s?([\-\-\&,])\s?(\p{L}+)/u", $var->raw, $matches)){
216
-                return $matches[1].$matches[2].$matches[3];
215
+            if (isset($var->raw) && preg_match("/(\p{L}+)\s?([\-\-\&,])\s?(\p{L}+)/u", $var->raw, $matches)) {
216
+                return $matches[1] . $matches[2] . $matches[3];
217 217
             }
218 218
         }
219 219
         // fallback:
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
         $data = [];
243 243
         foreach ($dates as $date) {
244 244
             if ($date[0] < 1000) {
245
-                $dateTime = new DateTime(0,0,0);
245
+                $dateTime = new DateTime(0, 0, 0);
246 246
                 $dateTime->setDay(0)->setMonth(0)->setYear(0);
247 247
                 $data[] = $dateTime;
248 248
             }
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
                 $dp = $this->dateParts->toArray();
348 348
                 $i = 0;
349 349
                 $dateParts_ = [];
350
-                array_walk($dp, function ($datePart, $key) use (&$i, &$dateParts_, $differentParts) {
350
+                array_walk($dp, function($datePart, $key) use (&$i, &$dateParts_, $differentParts) {
351 351
                     if (strpos($key, "year") !== false || strpos($key, "month") !== false) {
352 352
                         $dateParts_["yearmonth"][] = $datePart;
353 353
                     }
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
                 $dp = $this->dateParts->toArray();
361 361
                 $i = 0;
362 362
                 $dateParts_ = [];
363
-                array_walk($dp, function ($datePart, $key) use (&$i, &$dateParts_, $differentParts) {
363
+                array_walk($dp, function($datePart, $key) use (&$i, &$dateParts_, $differentParts) {
364 364
                     if (strpos($key, "year") !== false || strpos($key, "day") !== false) {
365 365
                         $dateParts_["yearday"][] = $datePart;
366 366
                     }
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
                 $dp = $this->dateParts->toArray();
374 374
                 $i = 0;
375 375
                 $dateParts_ = [];
376
-                array_walk($dp, function ($datePart, $key) use (&$i, &$dateParts_, $differentParts) {
376
+                array_walk($dp, function($datePart, $key) use (&$i, &$dateParts_, $differentParts) {
377 377
                     //$bit = sprintf("%03d", decbin($differentParts));
378 378
                     if (strpos($key, "month") !== false || strpos($key, "day") !== false) {
379 379
                         $dateParts_["monthday"][] = $datePart;
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
         $from = $datePart->renderWithoutAffixes($from, $this);
424 424
         $to = $datePart->renderWithoutAffixes($to, $this);
425 425
         $suffix = !empty($to) ? $datePart->renderSuffix() : "";
426
-        return $prefix.$from.$delim.$to.$suffix;
426
+        return $prefix . $from . $delim . $to . $suffix;
427 427
     }
428 428
 
429 429
     /**
@@ -448,9 +448,9 @@  discard block
 block discarded – undo
448 448
         // no custom date parts within the date element (this)?
449 449
         if (!empty($dateFromLocale)) {
450 450
 
451
-            $dateForm = array_filter(is_array($dateFromLocale) ? $dateFromLocale : [$dateFromLocale], function ($element) use ($format) {
451
+            $dateForm = array_filter(is_array($dateFromLocale) ? $dateFromLocale : [$dateFromLocale], function($element) use ($format) {
452 452
                 /** @var \SimpleXMLElement $element */
453
-                $dateForm = (string)$element->attributes()["form"];
453
+                $dateForm = (string) $element->attributes()["form"];
454 454
                 return $dateForm === $format;
455 455
             });
456 456
 
Please login to merge, or discard this patch.
src/Seboettg/CiteProc/Rendering/Name/Name.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,6 +105,9 @@  discard block
 block discarded – undo
105 105
         $this->initDelimiterAttributes($node);
106 106
     }
107 107
 
108
+    /**
109
+     * @param integer|null $citationNumber
110
+     */
108 111
     public function render($data, $citationNumber)
109 112
     {
110 113
         if (!$this->attributesInitialized) {
@@ -266,7 +269,7 @@  discard block
 block discarded – undo
266 269
     }
267 270
 
268 271
     /**
269
-     * @param $name
272
+     * @param \stdClass $name
270 273
      * @return string
271 274
      */
272 275
     private function getNamesString($name, $rank)
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
         $etAl = false;
115 115
         $count = 0;
116 116
 
117
-        $hasPreceding = CiteProc::getContext()->getCitationItems()->hasKey($citationNumber-1);
117
+        $hasPreceding = CiteProc::getContext()->getCitationItems()->hasKey($citationNumber - 1);
118 118
         if ($hasPreceding) {
119 119
             /** @var \stdClass $preceding */
120
-            $preceding = CiteProc::getContext()->getCitationItems()->get($citationNumber-1);
120
+            $preceding = CiteProc::getContext()->getCitationItems()->get($citationNumber - 1);
121 121
         }
122 122
 
123 123
         $subsequentSubstitution = CiteProc::getContext()->getCitationItems()->getSubsequentAuthorSubstitute();
@@ -205,16 +205,16 @@  discard block
 block discarded – undo
205 205
                     if (count($resultNames) === 1) {
206 206
                         $text .= " $etAl";
207 207
                     } else {
208
-                        $text .=  $this->delimiter . $etAl;
208
+                        $text .= $this->delimiter . $etAl;
209 209
                     }
210 210
 
211 211
             }
212 212
         }
213 213
         if ($this->form == 'count') {
214 214
             if ($etAl === false) {
215
-                return (int)count($resultNames);
215
+                return (int) count($resultNames);
216 216
             } else {
217
-                return (int)(count($resultNames) - 1);
217
+                return (int) (count($resultNames) - 1);
218 218
             }
219 219
         }
220 220
         // strip out the last delimiter if not required
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
         if (count($this->nameParts) > 0) {
257 257
             /** @var NamePart $namePart */
258 258
             foreach ($this->nameParts as $namePart) {
259
-                $nameObj->{$namePart->getName()} =   $namePart->render($name);
259
+                $nameObj->{$namePart->getName()} = $namePart->render($name);
260 260
             }
261 261
         }
262 262
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 
307 307
                         //remove last comma when no suffix exist.
308 308
                         $text = trim($text);
309
-                        $text = substr($text, -1) === "," ? substr($text, 0, strlen($text)-1) : $text;
309
+                        $text = substr($text, -1) === "," ? substr($text, 0, strlen($text) - 1) : $text;
310 310
                         break;
311 311
                     default:
312 312
                         /*
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -146,8 +146,7 @@
 block discarded – undo
146 146
                         $resultNames[] = $this->formatName($name, $rank);
147 147
                     }
148 148
                 }
149
-            }
150
-            else {
149
+            } else {
151 150
                 $resultNames[] = $this->formatName($name, $rank);
152 151
             }
153 152
         }
Please login to merge, or discard this patch.
src/Seboettg/CiteProc/Style/InheritableNameAttributesTrait.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         $parentStyleElement = null;
198 198
         if ($this instanceof  Name) {
199 199
             $parentStyleElement = ($context->isModeBibliography() ? $context->getBibliography() : $context->getCitation());
200
-        } else if ($this instanceof StyleElement){
200
+        } else if ($this instanceof StyleElement) {
201 201
             $parentStyleElement = $context->getRoot();
202 202
         }
203 203
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
                 case 'and':
208 208
                     $and = "";
209 209
                     if (!empty($attribute)) {
210
-                        $and = (string)$attribute;
210
+                        $and = (string) $attribute;
211 211
 
212 212
                     } else if (!empty($parentStyleElement)) { //inherit from parent style
213 213
                         $and = $parentStyleElement->getAnd();
@@ -220,14 +220,14 @@  discard block
 block discarded – undo
220 220
                     break;
221 221
                 case 'delimiter-precedes-et-al':
222 222
                     if (!empty($attribute)) {
223
-                        $this->delimiterPrecedesEtAl = (string)$attribute;
223
+                        $this->delimiterPrecedesEtAl = (string) $attribute;
224 224
                     } else if (!empty($parentStyleElement)) { //inherit from parent style
225 225
                         $this->delimiterPrecedesEtAl = $parentStyleElement->getDelimiterPrecedesEtAl();
226 226
                     }
227 227
                     break;
228 228
                 case 'delimiter-precedes-last':
229 229
                     if (!empty($attribute)) {
230
-                        $this->delimiterPrecedesLast = (string)$attribute;
230
+                        $this->delimiterPrecedesLast = (string) $attribute;
231 231
                     } else if (!empty($parentStyleElement)) { //inherit from parent style
232 232
                         $this->delimiterPrecedesLast = $parentStyleElement->getDelimiterPrecedesLast();
233 233
                     }
@@ -241,14 +241,14 @@  discard block
 block discarded – undo
241 241
                     break;
242 242
                 case 'et-al-use-first':
243 243
                     if (!empty($attribute)) {
244
-                        $this->etAlUseFirst = intval((string)$attribute);
244
+                        $this->etAlUseFirst = intval((string) $attribute);
245 245
                     } else if (!empty($parentStyleElement)) {
246 246
                         $this->etAlUseFirst = $parentStyleElement->getEtAlUseFirst();
247 247
                     }
248 248
                     break;
249 249
                 case 'et-al-subsequent-min':
250 250
                     if (!empty($attribute)) {
251
-                        $this->etAlSubsequentMin = intval((string)$attribute);
251
+                        $this->etAlSubsequentMin = intval((string) $attribute);
252 252
                     } else if (!empty($parentStyleElement)) {
253 253
                         $this->etAlSubsequentMin = $parentStyleElement->getEtAlSubsequentMin();
254 254
                     }
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
                     break;
279 279
                 case 'initialize-with':
280 280
                     if (!empty($attribute)) {
281
-                        $this->initializeWith = (string)$attribute;
281
+                        $this->initializeWith = (string) $attribute;
282 282
                     } else if (!empty($parentStyleElement)) {
283 283
                         $this->initializeWith = $parentStyleElement->getInitializeWith();
284 284
                     }
Please login to merge, or discard this patch.
src/Seboettg/CiteProc/Rendering/Layout.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -73,8 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
         if (CiteProc::getContext()->isModeBibliography()) {
75 75
             if ($data instanceof DataList) {
76
-                foreach ($data as $citationNumber => $item) {
77
-                    ++self::$numberOfCitedItems;
76
+                foreach ($data as $citationNumber => $item) {++self::$numberOfCitedItems;
78 77
                     CiteProc::getContext()->getResults()->append($this->wrapBibEntry($this->renderSingle($item, $citationNumber)));
79 78
                 }
80 79
                 $ret .= implode($this->delimiter, CiteProc::getContext()->getResults()->toArray());
@@ -82,7 +81,7 @@  discard block
 block discarded – undo
82 81
                 $ret .= $this->wrapBibEntry($this->renderSingle($data, $citationNumber));
83 82
             }
84 83
 
85
-            return "<div class=\"csl-bib-body\">".$ret."\n</div>";
84
+            return "<div class=\"csl-bib-body\">" . $ret . "\n</div>";
86 85
 
87 86
         } else if (CiteProc::getContext()->isModeCitation()) {
88 87
             if (is_array($data) || $data instanceof DataList) {
Please login to merge, or discard this patch.
src/Seboettg/CiteProc/Rendering/Number.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
                     $num2 = Util\Number::dec2roman($matches[3]);
100 100
                     $text = $this->buildNumberRangeString($num1, $num2, $matches[2]);
101 101
                 } else {
102
-                    $text =  Util\Number::dec2roman($var);
102
+                    $text = Util\Number::dec2roman($var);
103 103
                 }
104 104
                 break;
105 105
             case 'numeric':
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
                 if (preg_match("/\s*(\d+)\s*[\-\-\&,]\s*(\d+)\s*/", $var, $matches)) {
115 115
                     $text = $this->buildNumberRangeString($matches[1], $matches[3], $matches[2]);
116 116
                 } else {
117
-                    $text =  Util\Number::dec2roman($var);
117
+                    $text = Util\Number::dec2roman($var);
118 118
                 }
119 119
                 break;
120 120
         }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
             $numRange = "$num1 " . self::RANGE_DELIMITER_AMPERSAND . " $num2";
159 159
         } else if (self::RANGE_DELIMITER_COMMA === $delim) {
160 160
             $numRange = $num1 . htmlentities(self::RANGE_DELIMITER_COMMA) . " $num2";
161
-        } else  {
161
+        } else {
162 162
             $numRange = $num1 . self::RANGE_DELIMITER_HYPHEN . $num2;
163 163
         }
164 164
         return $numRange;
Please login to merge, or discard this patch.
src/Seboettg/CiteProc/Locale/LocaleXmlParserTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     {
61 61
         /** @var \SimpleXMLElement $node */
62 62
         foreach ($locale as $node) {
63
-            switch($node->getName()) {
63
+            switch ($node->getName()) {
64 64
                 case 'style-options':
65 65
                     $this->optionsXml->add('options', $node);
66 66
                     foreach ($node->attributes() as $name => $value) {
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
                     }
109 109
                     break;
110 110
                 case 'date':
111
-                    $form = (string)$node["form"];
111
+                    $form = (string) $node["form"];
112 112
                     $this->dateXml->add($form, $node);
113 113
                     foreach ($node->children() as $child) {
114 114
                         $date = new \stdClass();
Please login to merge, or discard this patch.