Completed
Pull Request — master (#30)
by John
05:33 queued 03:53
created

AbstractBoxRenderer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 78.56%

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 34
ccs 11
cts 14
cp 0.7856
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 21 2
1
<?php
2
3
namespace Graze\CiffRenderer\Field\Renderer\GraphicPrimitive;
4
5
use Graze\CiffRenderer\Field\Renderer\GraphicPrimitive\AbstractGraphicPrimitiveRenderer;
6
7
abstract class AbstractBoxRenderer extends AbstractGraphicPrimitiveRenderer
8
{
9
    /**
10
     * @return Intervention/Image/Image
0 ignored issues
show
Documentation Bug introduced by
The doc comment Intervention/Image/Image at position 0 could not be parsed: Unknown type name 'Intervention/Image/Image' at position 0 in Intervention/Image/Image.
Loading history...
11
     */
12 1
    public function render()
13
    {
14 1
        $canvas = $this->getImageManager()->canvas($this->getWidth(), $this->getHeight(), $this->getTracerColour());
15
16 1
        $rectangleConf = function ($rectangle) {
17
            $rectangle->border($this->getLineWeight(), '#000');
18
19
            if ($this->isFilled()) {
20
                $rectangle->background('#000');
21
            }
22 1
        };
23
24 1
        $canvas->rectangle(
25 1
            0,
26 1
            0,
27 1
            $this->getWidth() - $this->getLineWeight(),
28 1
            $this->getHeight() - $this->getLineWeight(),
29 1
            $rectangleConf
30
        );
31
32 1
        return $canvas;
33
    }
34
35
    /**
36
     * Is the box filled, or just an outline?
37
     *
38
     * @var bool
39
     */
40
    abstract protected function isFilled();
41
}
42