Completed
Pull Request — master (#86)
by Vladimir
38:05 queued 09:07
created

CompilerPostRenderRepeaterPageView   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 100 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 55.56%

Importance

Changes 0
Metric Value
wmc 3
lcom 2
cbo 2
dl 29
loc 29
ccs 5
cts 9
cp 0.5556
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 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 triggered after a Repeater PageView is compiled and before it is written to a file. The compiled output
16
 * is accessible and can be modified before it is written out to a file.
17
 *
18
 * @since 0.2.0
19
 */
20 View Code Duplication
class CompilerPostRenderRepeaterPageView 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...
21
{
22
    use CompilerPostRenderTrait;
23
24
    const NAME = 'compiler.postrender.repeater_pageview';
25
26
    private $pageView;
27
    private $expandedValue;
28
29
    /**
30
     * @param string $compiledOutput
31
     */
32 3
    public function __construct(RepeaterPageView $pageView, ExpandedValue $expandedValue, $compiledOutput)
33
    {
34 3
        $this->pageView = $pageView;
35 3
        $this->expandedValue = $expandedValue;
36 3
        $this->compiledOutput = $compiledOutput;
37 3
    }
38
39
    public function getPageView()
40
    {
41
        return clone $this->pageView;
42
    }
43
44
    public function getExpandedValue()
45
    {
46
        return clone $this->expandedValue;
47
    }
48
}
49