-
Notifications
You must be signed in to change notification settings - Fork 6
/
CommentClient.php
64 lines (57 loc) · 1.27 KB
/
CommentClient.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* vipnytt/RobotsTxtParser
*
* @link https://github.com/VIPnytt/RobotsTxtParser
* @license https://github.com/VIPnytt/RobotsTxtParser/blob/master/LICENSE The MIT License (MIT)
*/
namespace vipnytt\RobotsTxtParser\Client\Directives;
use vipnytt\RobotsTxtParser\RobotsTxtInterface;
/**
* Class CommentClient
*
* @see https://github.com/VIPnytt/RobotsTxtParser/blob/master/docs/methods/CommentClient.md for documentation
* @package vipnytt\RobotsTxtParser\Client\Directives
*/
class CommentClient implements ClientInterface, RobotsTxtInterface
{
/**
* User-agent
* @var string
*/
private $userAgent;
/**
* Comments
* @var string[]
*/
private $comments = [];
/**
* CommentClient constructor.
*
* @param string $userAgent
* @param array $comments
*/
public function __construct($userAgent, array $comments)
{
$this->userAgent = $userAgent;
$this->comments = $comments;
}
/**
* Get
*
* @return string[]
*/
public function get()
{
return $this->userAgent === self::USER_AGENT ? [] : $this->export();
}
/**
* Export
*
* @return string[]
*/
public function export()
{
return $this->comments;
}
}