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

WeekViewHelper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A initializeArguments() 0 6 1
A render() 0 12 1
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