FeedFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 38
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A makeRequest() 0 13 1
1
<?php
2
3
namespace ejdelmonico\LaravelRSSFeed;
4
5
use ejdelmonico\LaravelRSSFeed\helpers\SimplePieSetUp;
6
7
class FeedFactory
8
{
9
    /** @var array */
10
    protected $config;
11
12
    /** @var object */
13
    protected $feeder;
14
15
    /**
16
     * Load the config.
17
     *
18
     * @var array
19
     */
20
    public function __construct(array $config)
21
    {
22
        /* @var array $config */
23
        $this->config = $config;
24
    }
25
26
    /**
27
     * @param $url
28
     *
29
     * @return \ejdelmonico\LaravelRSSFeed\helpers\SimplePieSetUp
30
     */
31
    public function makeRequest($url)
32
    {
33
        /* @var object $this->feeder */
34
        $this->feeder = new SimplePieSetUp();
35
36
        /* add required options */
37
        $this->feeder->loadConfig($this->config);
38
        $this->feeder->setRSSFeedUrl($url);
39
        $this->feeder->init();
40
        $this->feeder->handleContentType();
41
42
        return $this->feeder;
43
    }
44
}
45