Test Failed
Push — master ( 772f18...8c594b )
by Alec
03:05
created

CounterReportFormatter::full()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 1
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * User: alec
4
 * Date: 10.12.18
5
 * Time: 14:22
6
 */
7
declare(strict_types=1);
8
9
namespace AlecRabbit\Tools\Reports\Formatters;
10
11
use AlecRabbit\Tools\Reports\CounterReport;
12
use const AlecRabbit\Constants\Accessories\DEFAULT_NAME;
0 ignored issues
show
Bug introduced by
The constant AlecRabbit\Constants\Accessories\DEFAULT_NAME was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
13
14
class CounterReportFormatter extends Formatter
15
{
16
    /** @var CounterReport */
17
    protected $report;
18
19
    public function setStyles(): void
20
    {
21
    }
22
23
    public function getString($colored = true): string
24
    {
25
        if (DEFAULT_NAME === $name = $this->report->getName()) {
26
            return $this->count($colored);
0 ignored issues
show
Unused Code introduced by
The call to AlecRabbit\Tools\Reports...eportFormatter::count() has too many arguments starting with $colored. ( Ignorable by Annotation )

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

26
            return $this->/** @scrutinizer ignore-call */ count($colored);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
27
        }
28
        return $this->full($name);
29
    }
30
31
    /**
32
     * @return string
33
     * @throws \Throwable
34
     */
35
    public function count(): string
36
    {
37
        return
38
            sprintf(
39
                'Counter: %s(%s)%s',
40
                $this->theme->comment($this->report->getValue()),
0 ignored issues
show
Bug introduced by
The method comment() does not exist on AlecRabbit\ConsoleColour. It seems like you code against a sub-type of AlecRabbit\ConsoleColour such as AlecRabbit\Tools\Internal\Theme. ( Ignorable by Annotation )

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

40
                $this->theme->/** @scrutinizer ignore-call */ 
41
                              comment($this->report->getValue()),
Loading history...
41
                $this->theme->dark($this->report->getStep()),
0 ignored issues
show
Bug introduced by
The method dark() does not exist on AlecRabbit\ConsoleColour. It seems like you code against a sub-type of AlecRabbit\ConsoleColour such as AlecRabbit\Tools\Internal\Theme. ( Ignorable by Annotation )

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

41
                $this->theme->/** @scrutinizer ignore-call */ 
42
                              dark($this->report->getStep()),
Loading history...
42
                PHP_EOL
43
            );
44
    }
45
46
    /**
47
     * @param string $name
48
     * @return string
49
     * @throws \Throwable
50
     */
51
    public function full(string $name): string
52
    {
53
        return
54
            sprintf(
55
                'Counter:[%s] Value: %s, Step: %s %s',
56
                $name,
57
                $this->theme->comment($this->report->getValue()),
58
                $this->report->getStep(),
59
                PHP_EOL
60
            );
61
    }
62
}