Font::font()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 10
ccs 0
cts 7
cp 0
crap 6
rs 10
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\FontAware;
19
20
trait Font
21
{
22
    public function font(Command $command)
23
    {
24
        /** @var Command|FontAware $command */
25
        $font = \sprintf('FT "%s"', $command->getFontName());
0 ignored issues
show
Bug introduced by
The method getFontName() 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\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
        $font = \sprintf('FT "%s"', $command->/** @scrutinizer ignore-call */ getFontName());
Loading history...
26
27
        if ($command->getFontSize()) {
0 ignored issues
show
Bug introduced by
The method getFontSize() 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\TextBlock. ( Ignorable by Annotation )

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

27
        if ($command->/** @scrutinizer ignore-call */ getFontSize()) {
Loading history...
28
            $font .= ",".(int) $command->getFontSize();
29
        }
30
31
        yield $font;
32
    }
33
}
34