Output::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 3
nc 4
nop 2
crap 3
1
<?php
2
namespace nstdio\svg\output;
3
4
/**
5
 * Class Output
6
 *
7
 * @package nstdio\svg\output
8
 * @author  Edgar Asatryan <[email protected]>
9
 */
10
class Output implements OutputInterface
11
{
12
    /**
13
     * @var FileOutputInterface
14
     */
15
    private $fileImpl;
16
17
    /**
18
     * @var ImageOutputInterface
19
     */
20
    private $imageImpl;
21
22 150
    public function __construct(FileOutputInterface $fileOutput = null, ImageOutputInterface $imageOutput = null)
23
    {
24 150
        $this->fileImpl = $fileOutput === null ? new FileOutput() : $fileOutput;
25 150
        $this->imageImpl = $imageOutput === null ? new ImageOutput() : $imageOutput;
26 150
    }
27
28
    /**
29
     * @inheritdoc
30
     */
31 2
    public function file($name, $content, $override)
32
    {
33 2
        return $this->fileImpl->file($name, $content, $override);
34
    }
35
36
    /**
37
     * @inheritdoc
38
     */
39
    public function imageFile($content, $name, $format, $override)
40
    {
41
        return $this->imageImpl->imageFile($content, $name, $format, $override);
42
    }
43
44
    /**
45
     * @inheritdoc
46
     */
47
    public function image($content, $format, $sendHeader)
48
    {
49
        return $this->imageImpl->image($content, $format, $sendHeader);
50
    }
51
52
    /**
53
     * @inheritdoc
54
     */
55
    public function setFileOutput(FileOutputInterface $fileOutput)
56
    {
57
        $this->fileImpl = $fileOutput;
58
    }
59
60
    /**
61
     * @inheritdoc
62
     */
63
    public function setImageOutput(ImageOutputInterface $imageOutput)
64
    {
65
        $this->imageImpl = $imageOutput;
66
    }
67
}