CacheDecoratorFactory::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace SkautisBundle\Skautis\Wsdl;
4
5
use Skautis\Wsdl\WebServiceFactoryInterface;
6
use Skautis\Wsdl\Decorator\Cache\CacheInterface;
7
use Skautis\Wsdl\Decorator\Cache\CacheDecorator;
8
9
/**
10
 * Trida pro pridavani cache decoratur na web service
11
 */
12
class CacheDecoratorFactory implements WebServiceFactoryInterface
13
{
14
    /**
15
     * @var WebServiceFactoryInterface
16
     */
17
    protected $webServiceFactory;
18
19
    /**
20
     * @var CacheInterface
21
     */
22
    protected $cache;
23
24
    public function __construct(WebServiceFactoryInterface $webServiceFactory, CacheInterface $cache)
25
    {
26
        $this->webServiceFactory = $webServiceFactory;
27
        $this->cache = $cache;
28
    }
29
30
    public function createWebService($url, array $options)
31
    {
32
        $webService = $this->webServiceFactory->createWebService($url, $options);
33
        $webService = new CacheDecorator($webService, $this->cache);
34
35
        return $webService;
36
    }
37
}
38