APalette::getTemplate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AlecRabbit\Spinner\Core\Palette\A;
6
7
use AlecRabbit\Spinner\Contract\IFrame;
8
use AlecRabbit\Spinner\Core\Palette\Contract\IPalette;
9
use AlecRabbit\Spinner\Core\Palette\Contract\IPaletteMode;
10
use AlecRabbit\Spinner\Core\Palette\Contract\IPaletteOptions;
11
use AlecRabbit\Spinner\Core\Palette\Contract\IPaletteTemplate;
12
use AlecRabbit\Spinner\Core\Palette\PaletteOptions;
0 ignored issues
show
Bug introduced by
The type AlecRabbit\Spinner\Core\Palette\PaletteOptions 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...
13
use AlecRabbit\Spinner\Core\Palette\PaletteTemplate;
0 ignored issues
show
Bug introduced by
The type AlecRabbit\Spinner\Core\Palette\PaletteTemplate 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...
14
use Traversable;
15
16
abstract class APalette implements IPalette
17
{
18
    public function __construct(
19
        protected IPaletteOptions $options = new PaletteOptions(),
20
    ) {
21
    }
22
23
    // FIXME (2023-12-04 16:9) [Alec Rabbit]: extract functionality to PaletteTemplateFactory->create($palette)
24
    public function getTemplate(?IPaletteMode $mode = null): IPaletteTemplate
25
    {
26
        return new PaletteTemplate(
27
            $this->getEntries($mode),
28
            $this->getOptions($mode),
29
        );
30
    }
31
32
    /**
33
     * @return Traversable<IFrame>
34
     */
35
    abstract protected function getEntries(?IPaletteMode $mode = null): Traversable;
36
37
    protected function getOptions(?IPaletteMode $mode = null): IPaletteOptions
0 ignored issues
show
Unused Code introduced by
The parameter $mode is not used and could be removed. ( Ignorable by Annotation )

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

37
    protected function getOptions(/** @scrutinizer ignore-unused */ ?IPaletteMode $mode = null): IPaletteOptions

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
    {
39
        return $this->options;
40
    }
41
}
42