1 | <?php |
||
15 | class HttpTransport extends AbstractTransport implements ProgressAwareInterface |
||
16 | { |
||
17 | /** |
||
18 | * @var ClientInterface |
||
19 | */ |
||
20 | protected $client; |
||
21 | |||
22 | /** |
||
23 | * @var int |
||
24 | */ |
||
25 | protected $size; |
||
26 | |||
27 | /** |
||
28 | * @var \DateTime |
||
29 | */ |
||
30 | protected $lastModified; |
||
31 | |||
32 | /** |
||
33 | * @param string $url |
||
34 | * @param string|null $user |
||
35 | * @param string|null $pass |
||
36 | * |
||
37 | * @return HttpTransport |
||
38 | */ |
||
39 | 22 | public static function create($url, $user = null, $pass = null) |
|
58 | |||
59 | /** |
||
60 | * @inheritdoc |
||
61 | */ |
||
62 | 4 | public function __toString() |
|
66 | |||
67 | /** |
||
68 | * @throws \LogicException When url is not defined |
||
69 | * |
||
70 | * @return string |
||
71 | */ |
||
72 | 22 | public function getUrl() |
|
80 | |||
81 | /** |
||
82 | * @param string $url |
||
83 | */ |
||
84 | 2 | public function setUrl($url) |
|
88 | |||
89 | /** |
||
90 | * @return string|null |
||
91 | */ |
||
92 | 16 | public function getUser() |
|
96 | |||
97 | /** |
||
98 | * @return string|null |
||
99 | */ |
||
100 | 4 | public function getPass() |
|
104 | |||
105 | /** |
||
106 | * @param ClientInterface $client |
||
107 | */ |
||
108 | 22 | public function setClient(ClientInterface $client) |
|
112 | |||
113 | /** |
||
114 | * @return ClientInterface |
||
115 | */ |
||
116 | public function getClient() |
||
120 | |||
121 | /** |
||
122 | * @inheritdoc |
||
123 | */ |
||
124 | public function getLastModifiedDate() |
||
128 | |||
129 | /** |
||
130 | * @return int|null |
||
131 | */ |
||
132 | public function getSize() |
||
136 | |||
137 | /** |
||
138 | * @param ResponseInterface $response |
||
139 | */ |
||
140 | 6 | public function onHeaders(ResponseInterface $response) |
|
147 | |||
148 | /** |
||
149 | * @param int $downloadSize |
||
150 | * @param int $downloaded |
||
151 | */ |
||
152 | 6 | public function onProgress($downloadSize, $downloaded) |
|
159 | |||
160 | /** |
||
161 | * @inheritdoc |
||
162 | */ |
||
163 | 14 | protected function doFetch($destination) |
|
189 | |||
190 | /** |
||
191 | * @inheritdoc |
||
192 | */ |
||
193 | 14 | protected function isFresh($destination, \DateTime $maxAge = null) |
|
197 | } |
||
198 |