Completed
Push — master ( cf0606...512c88 )
by Jan-Petter
04:57
created

RobotVersion::add()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 5
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 5
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
namespace vipnytt\RobotsTxtParser\Parser\Directives;
3
4
use vipnytt\RobotsTxtParser\Parser\RobotsTxtInterface;
5
6
/**
7
 * Class RobotVersion
8
 *
9
 * @package vipnytt\RobotsTxtParser\Parser\Directives
10
 */
11 View Code Duplication
class RobotVersion implements DirectiveInterface, RobotsTxtInterface
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...
12
{
13
    /**
14
     * Directive
15
     */
16
    const DIRECTIVE = self::DIRECTIVE_ROBOT_VERSION;
17
18
    /**
19
     * RobotVersion array
20
     * @var array
21
     */
22
    protected $array = [];
23
24
    /**
25
     * RobotVersion constructor.
26
     */
27
    public function __construct()
28
    {
29
    }
30
31
    /**
32
     * Add
33
     *
34
     * @param string $line
35
     * @return bool
36
     */
37
    public function add($line)
38
    {
39
        $this->array = [$line];
40
        return true;
41
    }
42
43
    /**
44
     * Export
45
     *
46
     * @return array
47
     */
48
    public function export()
49
    {
50
        return empty($this->array) ? [] : [self::DIRECTIVE => $this->array];
51
    }
52
}
53