Completed
Push — master ( 0ecd6b...9f36b3 )
by Tim
03:56
created

WeekViewHelper::initializeArguments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
/**
3
 * Link to the week.
4
 */
5
namespace HDNET\Calendarize\ViewHelpers\Link;
6
7
/**
8
 * Link to the week.
9
 */
10
class WeekViewHelper extends AbstractLinkViewHelper
11
{
12
    /**
13
     * Init arguments
14
     */
15
    public function initializeArguments()
16
    {
17
        parent::initializeArguments();
18
        $this->registerArgument('date', \DateTime::class, '', true);
19
        $this->registerArgument('pageUid', 'int', '', false, 0);
20
    }
21
22
    /**
23
     * Render the link to the given day.
24
     *
25
     * @return string
26
     */
27
    public function render()
28
    {
29
        $date = $this->arguments['date'];
30
        $additionalParams = [
31
            'tx_calendarize_calendar' => [
32
                'year' => $date->format('Y'),
33
                'week' => $date->format('W'),
34
            ],
35
        ];
36
37
        return parent::renderLink($this->getPageUid($this->arguments['pageUid']), $additionalParams);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (renderLink() instead of render()). Are you sure this is correct? If so, you might want to change this to $this->renderLink().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
38
    }
39
}
40