Completed
Push — issue/87 ( bbd942 )
by Alex
04:44
created

Result::getResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
/*
3
 * This file is part of the feed-io package.
4
 *
5
 * (c) Alexandre Debril <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace FeedIo\Reader;
12
13
use FeedIo\Adapter\ResponseInterface;
14
use FeedIo\FeedInterface;
15
16
/**
17
 * Result of the read() operation
18
 *
19
 * a Result instance holds the following :
20
 *
21
 * - the Feed instance
22
 * - Date and time of the request
23
 * - value of the 'modifiedSince' header sent throught the request
24
 * - the raw response
25
 * - the DOM document
26
 * - URL of the feed
27
 */
28
class Result
29
{
30
31
    /**
32
     * @var \DateTime
33
     */
34
    protected $modifiedSince;
35
36
    /**
37
     * @var \DateTime
38
     */
39
    protected $date;
40
41
    /**
42
     * @var \FeedIo\FeedInterface
43
     */
44
    protected $feed;
45
46
    /**
47
     * @var \FeedIo\Adapter\ResponseInterface
48
     */
49
    protected $response;
50
51
    /**
52
     * @var \DomDocument
53
     */
54
    protected $document;
55
56
    /**
57
     * @var string
58
     */
59
    protected $url;
60
61
    /**
62
     * @param \DOMDocument      $document
63
     * @param FeedInterface     $feed
64
     * @param \DateTime         $modifiedSince
65
     * @param ResponseInterface $response
66
     * @param $url
67
     */
68 1
    public function __construct(
69
        \DOMDocument $document,
70
        FeedInterface $feed,
71
        \DateTime $modifiedSince,
72
        ResponseInterface $response,
73
        $url
74
    ) {
75 1
        $this->date = new \DateTime();
76 1
        $this->document = $document;
77 1
        $this->feed = $feed;
78 1
        $this->modifiedSince = $modifiedSince;
79 1
        $this->response = $response;
80 1
        $this->url = $url;
81 1
    }
82
83
    /**
84
     * @return \DateTime
85
     */
86 1
    public function getDate()
87
    {
88 1
        return $this->date;
89
    }
90
91
    /**
92
     * @return \DomDocument
93
     */
94 1
    public function getDocument()
95
    {
96 1
        return $this->document;
97
    }
98
99
    /**
100
     * @return FeedInterface
101
     */
102 1
    public function getFeed()
103
    {
104 1
        return $this->feed;
105
    }
106
107
    /**
108
     * @return \DateTime
109
     */
110
    public function getModifiedSince()
111
    {
112
        return $this->modifiedSince;
113
    }
114
115
    /**
116
     * @return ResponseInterface
117
     */
118
    public function getResponse()
119
    {
120
        return $this->response;
121
    }
122
123
    /**
124
     * @return string
125
     */
126
    public function getUrl()
127
    {
128
        return $this->url;
129
    }
130
}
131