Magnify   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A magnify() 0 5 3
A resetMagnify() 0 5 3
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\Language\Fingerprint\Concerns;
16
17
use PhpAidc\LabelPrinter\Contract\Command;
18
use PhpAidc\LabelPrinter\Command\Concerns\Magnifiable;
19
20
trait Magnify
21
{
22
    public function magnify(Command $command)
23
    {
24
        /** @var Command|Magnifiable $command */
25
        if ($command->getMagnificationWidth() > 1 || $command->getMagnificationHeight() > 1) {
0 ignored issues
show
Bug introduced by
The method getMagnificationHeight() does not exist on PhpAidc\LabelPrinter\Contract\Command. It seems like you code against a sub-type of PhpAidc\LabelPrinter\Contract\Command such as PhpAidc\LabelPrinter\Command\TextLine or PhpAidc\LabelPrinter\Command\InternalImage or PhpAidc\LabelPrinter\Command\TextBlock. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

25
        if ($command->getMagnificationWidth() > 1 || $command->/** @scrutinizer ignore-call */ getMagnificationHeight() > 1) {
Loading history...
Bug introduced by
The method getMagnificationWidth() does not exist on PhpAidc\LabelPrinter\Contract\Command. It seems like you code against a sub-type of PhpAidc\LabelPrinter\Contract\Command such as PhpAidc\LabelPrinter\Command\TextLine or PhpAidc\LabelPrinter\Command\InternalImage or PhpAidc\LabelPrinter\Command\TextBlock. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

25
        if ($command->/** @scrutinizer ignore-call */ getMagnificationWidth() > 1 || $command->getMagnificationHeight() > 1) {
Loading history...
26
            yield "MAG {$command->getMagnificationHeight()},{$command->getMagnificationWidth()}";
27
        }
28
    }
29
30
    public function resetMagnify(Command $command)
31
    {
32
        /** @var Command|Magnifiable $command */
33
        if ($command->getMagnificationWidth() > 1 || $command->getMagnificationHeight() > 1) {
34
            yield \sprintf('MAG %d,%d', 1, 1);
35
        }
36
    }
37
}
38