Completed
Push — psr2 ( 963c69...e24a74 )
by Andreas
05:37 queued 02:59
created

FeedParserFile::close()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace dokuwiki;
4
5
/**
6
 * Fetch an URL using our own HTTPClient
7
 *
8
 * Replaces SimplePie's own class
9
 */
10
class FeedParserFile extends \SimplePie_File
11
{
12
    protected $http;
13
    /** @noinspection PhpMissingParentConstructorInspection */
14
15
    /**
16
     * Inititializes the HTTPClient
17
     *
18
     * We ignore all given parameters - they are set in DokuHTTPClient
19
     *
20
     * @inheritdoc
21
     */
22
    public function __construct(
23
        $url,
24
        $timeout = 10,
25
        $redirects = 5,
26
        $headers = null,
27
        $useragent = null,
28
        $force_fsockopen = false,
29
        $curl_options = array()
30
    ) {
31
        $this->http = new \DokuHTTPClient();
32
        $this->success = $this->http->sendRequest($url);
33
34
        $this->headers = $this->http->resp_headers;
35
        $this->body = $this->http->resp_body;
36
        $this->error = $this->http->error;
37
38
        $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN;
39
40
        return $this->success;
0 ignored issues
show
Bug introduced by
Constructors do not have meaningful return values, anything that is returned from here is discarded. Are you sure this is correct?
Loading history...
41
    }
42
43
    /** @inheritdoc */
44
    public function headers()
45
    {
46
        return $this->headers;
47
    }
48
49
    /** @inheritdoc */
50
    public function body()
51
    {
52
        return $this->body;
53
    }
54
55
    /** @inheritdoc */
56
    public function close()
57
    {
58
        return true;
59
    }
60
}
61