Passed
Push — master ( 02a778...9f9faf )
by Sebastian
06:11
created

MonthDayRenderer   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 23
ccs 9
cts 9
cp 1
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A parseDateRange() 0 14 4
1
<?php
2
/*
1 ignored issue
show
Coding Style introduced by
You must use "/**" style comments for a file comment
Loading history...
3
 * citeproc-php: DateRangeMonthDayRenderer.php
4
 * User: Sebastian Böttger <[email protected]>
5
 * created at 03.11.19, 20:51
6
 */
7
8
namespace Seboettg\CiteProc\Rendering\Date\DateRange;
9
10
use Seboettg\CiteProc\Rendering\Date\DatePart;
11
use Seboettg\CiteProc\Rendering\Date\DateTime;
12
use Seboettg\Collection\ArrayList;
13
14
/**
15
 * Class MonthDayRenderer
16
 * @package Seboettg\CiteProc\Rendering\Date\DateRange
1 ignored issue
show
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
17
 */
4 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
18
class MonthDayRenderer extends DateRangeRenderer
19
{
20
    /**
1 ignored issue
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
21
     * @param ArrayList<DatePart> $dateParts
2 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
22
     * @param DateTime $from
3 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 12 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
23
     * @param DateTime $to
3 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 12 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
24
     * @param $delimiter
2 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
25
     * @return string
1 ignored issue
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
26
     */
27 1
    public function parseDateRange(ArrayList $dateParts, DateTime $from, DateTime $to, $delimiter)
28
    {
29 1
        $dp = $dateParts->toArray();
30 1
        $dateParts_ = [];
31 1
        array_walk($dp, function($datePart, $key) use (&$dateParts_) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
32
            //$bit = sprintf("%03d", decbin($differentParts));
33 1
            if (strpos($key, "month") !== false || strpos($key, "day") !== false) {
34 1
                $dateParts_["monthday"][] = $datePart;
35
            }
36 1
            if (strpos($key, "year") !== false) {
37 1
                $dateParts_["year"] = $datePart;
38
            }
39 1
        });
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
40
        return $this->renderDateParts($dateParts_, $from, $to, $delimiter);
41
    }
42
}
43