Completed
Push — master ( 1f7f5f...3bc145 )
by Jan-Petter
06:44
created

NoODP   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 0
cbo 0
dl 39
loc 39
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 8 8 3
A getDirective() 4 4 1
A getValue() 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
namespace vipnytt\XRobotsTagParser\directives;
3
4 View Code Duplication
final class NoODP implements directiveInterface
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...
5
{
6
    const DIRECTIVE = 'noodp';
7
8
    /**
9
     * Constructor
10
     *
11
     * @param string $rule
12
     * @param array $options
13
     */
14
    public function __construct($rule, $options = [])
15
    {
16
        foreach ($options as $key => $rule) {
17
            if (isset($this->$key)) {
18
                $this->$key = $rule;
19
            }
20
        }
21
    }
22
23
    /**
24
     * Get directive name
25
     *
26
     * @return string
27
     */
28
    public function getDirective()
29
    {
30
        return self::DIRECTIVE;
31
    }
32
33
    /**
34
     * Get value
35
     *
36
     * @return bool|string|null
37
     */
38
    public function getValue()
39
    {
40
        return true;
41
    }
42
}