1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
namespace AlecRabbit\Spinner\Core\Factory; |
7
|
|
|
|
8
|
|
|
use AlecRabbit\Spinner\Contract\Option\OptionStyleMode; |
9
|
|
|
use AlecRabbit\Spinner\Contract\Pattern\IPattern; |
10
|
|
|
use AlecRabbit\Spinner\Core\Factory\Contract\IFrameCollectionFactory; |
11
|
|
|
use AlecRabbit\Spinner\Core\Factory\Contract\IIntervalFactory; |
12
|
|
|
use AlecRabbit\Spinner\Core\Factory\Contract\IStyleFrameRevolverFactory; |
13
|
|
|
use AlecRabbit\Spinner\Core\Pattern\BakedPattern; |
|
|
|
|
14
|
|
|
use AlecRabbit\Spinner\Core\Pattern\Contract\IBakedPattern; |
15
|
|
|
use AlecRabbit\Spinner\Core\Pattern\Contract\IStylePattern; |
16
|
|
|
use AlecRabbit\Spinner\Core\Pattern\NoStylePattern; |
17
|
|
|
use AlecRabbit\Spinner\Core\Revolver\Contract\IFrameRevolver; |
18
|
|
|
use AlecRabbit\Spinner\Core\Revolver\Contract\IFrameRevolverBuilder; |
19
|
|
|
use AlecRabbit\Spinner\Core\Revolver\Contract\IRevolver; |
20
|
|
|
|
21
|
|
|
final class StyleFrameRevolverFactory implements IStyleFrameRevolverFactory |
22
|
|
|
{ |
23
|
|
|
public function __construct( |
24
|
|
|
protected IFrameRevolverBuilder $frameRevolverBuilder, |
25
|
|
|
protected IFrameCollectionFactory $frameCollectionFactory, |
26
|
|
|
protected IIntervalFactory $intervalFactory, |
27
|
|
|
protected OptionStyleMode $styleMode, |
28
|
|
|
) { |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function createStyleRevolver(IStylePattern $stylePattern): IFrameRevolver |
32
|
|
|
{ |
33
|
|
|
$bakedPattern = $this->bakePattern($stylePattern); |
34
|
|
|
return |
35
|
|
|
$this->frameRevolverBuilder |
36
|
|
|
->withFrameCollection($bakedPattern->getFrameCollection()) |
37
|
|
|
->withInterval($bakedPattern->getInterval()) |
38
|
|
|
->withTolerance( |
39
|
|
|
$this->getTolerance() |
40
|
|
|
) |
41
|
|
|
->build() |
42
|
|
|
; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
private function bakePattern(IPattern $pattern): IBakedPattern |
46
|
|
|
{ |
47
|
|
|
if (OptionStyleMode::NONE === $this->styleMode) { |
48
|
|
|
$pattern = new NoStylePattern(); |
49
|
|
|
} |
50
|
|
|
return |
51
|
|
|
new BakedPattern( |
52
|
|
|
frames: $this->frameCollectionFactory->create($pattern->getEntries($this->styleMode)), |
|
|
|
|
53
|
|
|
interval: $this->intervalFactory->createNormalized($pattern->getInterval()), |
54
|
|
|
); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
private function getTolerance(): int |
58
|
|
|
{ |
59
|
|
|
// TODO (2023-04-26 14:21) [Alec Rabbit]: make it configurable [fd86d318-9069-47e2-b60d-a68f537be4a3] |
60
|
|
|
return IRevolver::TOLERANCE; |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths