Completed
Pull Request — master (#86)
by Vladimir
02:09
created

CompilerPreRenderRepeaterPageView   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 100 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 3
lcom 2
cbo 2
dl 25
loc 25
ccs 4
cts 8
cp 0.5
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 5 5 1
A getPageView() 4 4 1
A getExpandedValue() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
/**
4
 * @copyright 2018 Vladimir Jimenez
5
 * @license   https://github.com/stakx-io/stakx/blob/master/LICENSE.md MIT
6
 */
7
8
namespace allejo\stakx\Event;
9
10
use allejo\stakx\Document\RepeaterPageView;
11
use allejo\stakx\FrontMatter\ExpandedValue;
12
use Symfony\Component\EventDispatcher\Event;
13
14
/**
15
 * This event is fired before a Repeater PageView is rendered and allows you inject custom variables into the templates.
16
 *
17
 * @since 0.2.0
18
 */
19 View Code Duplication
class CompilerPreRenderRepeaterPageView extends Event
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
{
21
    use CompilerPreRenderTrait;
22
23
    const NAME = 'compiler.prerender.repeater_pageview';
24
25
    private $pageView;
26
    private $expandedValue;
27
28 3
    public function __construct(RepeaterPageView $pageView, ExpandedValue $expandedValue)
29
    {
30 3
        $this->pageView = $pageView;
31 3
        $this->expandedValue = $expandedValue;
32 3
    }
33
34
    public function getPageView()
35
    {
36
        return clone $this->pageView;
37
    }
38
39
    public function getExpandedValue()
40
    {
41
        return clone $this->expandedValue;
42
    }
43
}
44