Completed
Push — master ( 39058d...36fe77 )
by Jan-Petter
02:07
created

AllowClient::isCovered()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
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
     * @deprecated 2.1.0
43
     * @see AllowClient::isCovered()
44
     *
45
     * @param  string $uri
46
     * @return int|false
47
     */
48
    public function hasPath($uri)
49
    {
50
        return mb_strlen($this->checkPaths($this->getPathFromUri($uri), $this->paths));
51
    }
52
53
    /**
54
     * Get the most specific rule
55
     *
56
     * @param  string $uri
57
     * @return string|false
58
     */
59
    public function isCovered($uri)
60
    {
61
        return $this->checkPaths($this->getPathFromUri($uri), $this->paths);
62
    }
63
64
    /**
65
     * Export
66
     *
67
     * @return array
68
     */
69
    public function export()
70
    {
71
        return $this->paths;
72
    }
73
}
74