StopwatchWebServiceFactory::createWebService()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 5
nc 2
nop 2
1
<?php
2
3
namespace SkautisBundle\Skautis\Wsdl;
4
5
use Skautis\Wsdl\WebServiceFactory;
6
use Symfony\Component\Stopwatch\Stopwatch;
7
8
/**
9
 * Trida pro vytvareni StopWatch instanci
10
 */
11
class StopwatchWebServiceFactory extends WebServiceFactory
12
{
13
14
    /**
15
     * Profilovani
16
     *
17
     * @var Stopwatch
18
     */
19
    protected $stopwatch = null;
20
21
    /**
22
     * Nastavi objekt pro profilovani
23
     *
24
     * @param Stopwatch $stopwatch Idealne ziskany z DIC
25
     */
26
    public function setStopwatch(Stopwatch $stopwatch)
27
    {
28
        $this->stopwatch = $stopwatch;
29
    }
30
31
    /**
32
     * @inheritdoc
33
     */
34
    public function createWebService($wsdl, array $init)
35
    {
36
        $ws = new $this->class($wsdl, $init);
37
38
        if ($this->stopwatch !== null) {
39
            $ws->setStopwatch($this->stopwatch);
40
        }
41
42
        return $ws;
43
    }
44
45
}
46