Completed
Push — master ( c5f2a4...b3cdb4 )
by Edgar
04:10
created

Output   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 4

Test Coverage

Coverage 37.5%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
c 1
b 0
f 0
lcom 2
cbo 4
dl 0
loc 58
ccs 6
cts 16
cp 0.375
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 3
A imageFile() 0 4 1
A image() 0 4 1
A setFileOutput() 0 4 1
A setImageOutput() 0 4 1
A file() 0 4 1
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 127
    public function __construct(FileOutputInterface $fileOutput = null, ImageOutputInterface $imageOutput = null)
23
    {
24 127
        $this->fileImpl = $fileOutput === null ? new FileOutput() : $fileOutput;
25 127
        $this->imageImpl = $imageOutput === null ? new ImageOutput() : $imageOutput;
26 127
    }
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
}