Passed
Push — main ( 80f8ac...067329 )
by Thomas
02:37
created

Section::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Conia\Boiler;
6
7
class Section
8
{
9
    /** @var list<string> */
0 ignored issues
show
Bug introduced by
The type Conia\Boiler\list was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
    protected array $prepended = [];
11
12
    /** @var list<string> */
13
    protected array $appended = [];
14
15 3
    public function __construct(protected string $value)
16
    {
17 3
    }
18
19 2
    public function prepend(string $content): self
20
    {
21 2
        $this->prepended[] = $content;
22
23 2
        return $this;
24
    }
25
26 2
    public function append(string $content): self
27
    {
28 2
        array_unshift($this->appended, $content);
29
30 2
        return $this;
31
    }
32
33 1
    public function empty(): bool
34
    {
35 1
        error_log(print_r($this->value, true));
0 ignored issues
show
Bug introduced by
It seems like print_r($this->value, true) can also be of type true; however, parameter $message of error_log() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

35
        error_log(/** @scrutinizer ignore-type */ print_r($this->value, true));
Loading history...
36
37 1
        return empty($this->value);
38
    }
39
40 3
    public function get(): string
41
    {
42 3
        return implode('', array_merge($this->prepended, [$this->value], $this->appended));
43
    }
44
45 1
    public function setValue(string $value): void
46
    {
47 1
        $this->value = $value;
48
    }
49
}
50