🤖 Rector and PHPCS fixes
[dokuwiki.git] / inc / FeedParserFile.php
blob3297a0d205c365c8993999e0ee825215c69242b0
1 <?php
3 namespace dokuwiki;
5 use SimplePie\File;
6 use SimplePie\SimplePie;
7 use dokuwiki\HTTP\DokuHTTPClient;
9 /**
10 * Fetch an URL using our own HTTPClient
12 * Replaces SimplePie's own class
14 class FeedParserFile extends File
16 protected $http;
17 /** @noinspection PhpMissingParentConstructorInspection */
19 /**
20 * Inititializes the HTTPClient
22 * We ignore all given parameters - they are set in DokuHTTPClient
24 * @inheritdoc
26 public function __construct(
27 $url
28 ) {
29 $this->http = new DokuHTTPClient();
30 $this->success = $this->http->sendRequest($url);
32 $this->headers = $this->http->resp_headers;
33 $this->body = $this->http->resp_body;
34 $this->error = $this->http->error;
36 $this->method = SimplePie::FILE_SOURCE_REMOTE | SimplePie::FILE_SOURCE_FSOCKOPEN;
38 return $this->success;
41 /** @inheritdoc */
42 public function headers()
44 return $this->headers;
47 /** @inheritdoc */
48 public function body()
50 return $this->body;
53 /** @inheritdoc */
54 public function close()
56 return true;