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

Section   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setValue() 0 3 1
A get() 0 3 1
A append() 0 5 1
A __construct() 0 2 1
A empty() 0 5 1
A prepend() 0 5 1
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