Completed
Push — master ( 6cdc7d...059552 )
by Jan-Petter
02:56
created

AllowClient::getPathFromUri()   B

Complexity

Conditions 5
Paths 6

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 8.8571
c 0
b 0
f 0
cc 5
eloc 11
nc 6
nop 1
1
<?php
2
/**
3
 * vipnytt/RobotsTxtParser
4
 *
5
 * @link https://github.com/VIPnytt/RobotsTxtParser
6
 * @license https://github.com/VIPnytt/RobotsTxtParser/blob/master/LICENSE The MIT License (MIT)
7
 */
8
9
namespace vipnytt\RobotsTxtParser\Client\Directives;
10
11
use vipnytt\RobotsTxtParser\RobotsTxtInterface;
12
13
/**
14
 * Class AllowClient
15
 *
16
 * @see https://github.com/VIPnytt/RobotsTxtParser/blob/master/docs/methods/AllowClient.md for documentation
17
 * @package vipnytt\RobotsTxtParser\Client\Directives
18
 */
19
class AllowClient implements ClientInterface, RobotsTxtInterface
20
{
21
    use DirectiveClientTrait;
22
23
    /**
24
     * Paths
25
     * @var array
26
     */
27
    private $paths;
28
29
    /**
30
     * AllowClient constructor.
31
     *
32
     * @param string[] $paths
33
     */
34
    public function __construct(array $paths)
35
    {
36
        $this->paths = $paths;
37
    }
38
39
    /**
40
     * Check
41
     *
42
     * @param  string $uri
43
     * @return int|false
44
     */
45
    public function hasPath($uri)
46
    {
47
        return $this->checkPaths($this->getPathFromUri($uri), $this->paths);
48
    }
49
50
    /**
51
     * Export
52
     *
53
     * @return array
54
     */
55
    public function export()
56
    {
57
        return $this->paths;
58
    }
59
}
60