Completed
Push — master ( 902e66...0cbd7a )
by Jan-Petter
02:44
created

HostParser::parse()   B

Complexity

Conditions 5
Paths 2

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 8
Bugs 1 Features 1
Metric Value
c 8
b 1
f 1
dl 0
loc 17
rs 8.8571
cc 5
eloc 11
nc 2
nop 1
1
<?php
2
namespace vipnytt\RobotsTxtParser\Parser\Directives;
3
4
use vipnytt\RobotsTxtParser\Client\Directives\HostClient;
5
6
/**
7
 * Class HostParser
8
 *
9
 * @package vipnytt\RobotsTxtParser\Parser\Directives
10
 */
11
class HostParser extends HostParserCore
12
{
13
    /**
14
     * HostParser constructor.
15
     *
16
     * @param string $base
17
     * @param string $effective
18
     */
19
    public function __construct($base, $effective)
20
    {
21
        parent::__construct($base, $effective);
22
    }
23
24
    /**
25
     * Client
26
     *
27
     * @return HostClient
28
     */
29
    public function client()
30
    {
31
        return new HostClient($this->base, $this->effective, $this->host);
32
    }
33
34
    /**
35
     * Render
36
     *
37
     * @return string[]
38
     */
39
    public function render()
40
    {
41
        return isset($this->host[0]) ? [
42
            self::DIRECTIVE_HOST . ':' . $this->host[0]
43
        ] : [];
44
    }
45
}
46