InternalImage   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 18
c 1
b 0
f 0
dl 0
loc 64
ccs 0
cts 27
cp 0
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A bpp() 0 5 1
A __construct() 0 5 1
A contrast() 0 5 1
A getContrast() 0 3 1
A getBpp() 0 3 1
1
<?php
2
3
/**
4
 * This file is part of PhpAidc LabelPrinter package.
5
 *
6
 * © Appwilio (https://appwilio.com)
7
 * © JhaoDa (https://github.com/jhaoda)
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
declare(strict_types=1);
14
15
namespace PhpAidc\LabelPrinter\Command;
16
17
use PhpAidc\LabelPrinter\Enum\TsplBpp;
18
use PhpAidc\LabelPrinter\Contract\Command;
19
use PhpAidc\LabelPrinter\Command\Concerns\Rotatable;
20
use PhpAidc\LabelPrinter\Command\Concerns\Invertible;
21
use PhpAidc\LabelPrinter\Command\Concerns\Magnifiable;
22
use PhpAidc\LabelPrinter\Command\Concerns\PositionAware;
23
24
/**
25
 * Prints an image stored in the printer's memory.
26
 */
27
final class InternalImage implements Command
28
{
29
    use Rotatable;
30
    use Invertible;
31
    use Magnifiable;
32
    use PositionAware;
33
34
    /** @var TsplBpp */
35
    private $bpp;
36
37
    /** @var int */
38
    private $contrast;
39
40
    /** @var string */
41
    private $name;
42
43
    public function __construct(int $x, int $y, string $name)
44
    {
45
        $this->x = $x;
46
        $this->y = $y;
47
        $this->name = $name;
48
    }
49
50
    /**
51
     * (TSPL) Bits per pixel.
52
     *
53
     * @param  TsplBpp  $bpp
54
     *
55
     * @return $this
56
     */
57
    public function bpp(TsplBpp $bpp)
58
    {
59
        $this->bpp = $bpp;
60
61
        return $this;
62
    }
63
64
    /**
65
     * (TSPL) Contrast of grayscale graphic.
66
     *
67
     * @param  int  $value
68
     *
69
     * @return $this
70
     */
71
    public function contrast(int $value)
72
    {
73
        $this->contrast = $value;
74
75
        return $this;
76
    }
77
78
    public function getBpp(): ?TsplBpp
79
    {
80
        return $this->bpp;
81
    }
82
83
    public function getContrast(): ?int
84
    {
85
        return $this->contrast;
86
    }
87
88
    public function getName(): string
89
    {
90
        return $this->name;
91
    }
92
}
93