Completed
Push — master ( 65fdb2...7704a6 )
by Ed
02:47
created

SimplePieSetUp   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 57
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A loadConfig() 0 14 1
A init() 0 4 1
A setRSSFeedUrl() 0 4 1
A handleContentType() 0 4 1
1
<?php
2
3
namespace ejdelmonico\LaravelRSSFeed\helpers;
4
5
use SimplePie;
6
7
/**
8
 * SimplePie SetUp.
9
 */
10
class SimplePieSetUp
11
{
12
    protected $feed;
13
14
    public function __construct()
15
    {
16
        $this->feed = new SimplePie();
17
    }
18
19
    /**
20
     * Load the config array.
21
     *
22
     * @param array $config
0 ignored issues
show
Bug introduced by
There is no parameter named $config. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
23
     *
24
     * @return \SimplePie
25
     */
26
    public function loadConfig()
27
    {
28
        $this->feed->set_cache_location(config('feed.cache.location'));
29
        $this->feed->set_cache_duration(config('cache.life'));
30
        $this->feed->enable_cache(config('cache.enabled'));
31
        $this->feed->set_item_limit(config('item_limit'));
32
        $this->feed->strip_htmltags(config('strip_htmltags.tags'));
33
        $this->feed->strip_attributes(config('strip_attributes.tags'));
34
        $this->feed->force_feed(config('force_feed.enabled'));
35
        $this->feed->enable_order_by_date(config('order_by_date.enabled'));
36
        $this->feed->strip_comments(config('strip_html_comments.enabled'));
37
38
        return $this->feed;
39
    }
40
41
    /**
42
     * Init SimplePie.
43
     */
44
    public function init()
45
    {
46
        $this->feed->init();
47
    }
48
49
    /**
50
     * Set the feed url.
51
     *
52
     * @param $url
53
     */
54
    public function setRSSFeedUrl($url)
55
    {
56
        $this->feed->set_feed_url($url);
57
    }
58
59
    /**
60
     * Wrapper for MIME-types.
61
     */
62
    public function handleContentType()
63
    {
64
        $this->feed->handle_content_type();
65
    }
66
}
67