Code Duplication    Length = 42-42 lines in 2 locations

src/RobotsTxtParser/Parser/Directives/Comment.php 1 location

@@ 11-52 (lines=42) @@
8
 *
9
 * @package vipnytt\RobotsTxtParser\Parser\Directives
10
 */
11
class Comment implements DirectiveInterface, RobotsTxtInterface
12
{
13
    /**
14
     * Directive
15
     */
16
    const DIRECTIVE = self::DIRECTIVE_COMMENT;
17
18
    /**
19
     * Comment array
20
     * @var array
21
     */
22
    protected $array = [];
23
24
    /**
25
     * Comment 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

src/RobotsTxtParser/Parser/Directives/RobotVersion.php 1 location

@@ 11-52 (lines=42) @@
8
 *
9
 * @package vipnytt\RobotsTxtParser\Parser\Directives
10
 */
11
class RobotVersion implements DirectiveInterface, RobotsTxtInterface
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