Completed
Branch master (1f9106)
by Nils
02:44
created

ResponseRetrieverExtension::getRetriever()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace whm\Smoke\Extensions\SmokeResponseRetriever;
4
5
use Ivory\HttpAdapter\HttpAdapterInterface;
6
use PhmLabs\Components\Init\Init;
7
use whm\Smoke\Config\Configuration;
8
9
class ResponseRetrieverExtension
10
{
11
    private $retriever;
12
13
    public function init(Configuration $_configuration)
14
    {
15
        if ($_configuration->hasSection('responseRetriever')) {
16
            $this->retriever = Init::initialize($_configuration->getSection('responseRetriever'));
17
        } else {
18
            throw new \RuntimeException("No response retriever set. Please check the config file if a section 'responseRetriever' exists.");
19
        }
20
    }
21
22
    /**
23
     * @Event("Scanner.Init")
24
     */
25
    public function setRetriever(HttpAdapterInterface $httpClient)
26
    {
27
        $this->retriever->setHttpClient($httpClient);
28
    }
29
30
    public function getRetriever()
31
    {
32
        return $this->retriever;
33
    }
34
}
35