Completed
Push — master ( 7e0ba3...cda426 )
by Ed
03:46
created

FeedFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

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