1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace AlecRabbit\Spinner\Core\Jugglers; |
4
|
|
|
|
5
|
|
|
use AlecRabbit\Spinner\Core\Calculator; |
6
|
|
|
use AlecRabbit\Spinner\Core\Coloring\Scott; |
7
|
|
|
use AlecRabbit\Spinner\Core\Style; |
|
|
|
|
8
|
|
|
use AlecRabbit\Spinner\Settings\Contracts\Defaults; |
9
|
|
|
|
10
|
|
|
class MessageJuggler extends AbstractJuggler |
11
|
|
|
{ |
12
|
|
|
/** @var string */ |
13
|
|
|
protected $message; |
14
|
|
|
/** @var int */ |
15
|
|
|
protected $erasingLength; |
16
|
|
|
/** @var string */ |
17
|
|
|
protected $frameString; |
18
|
|
|
/** @var string */ |
19
|
|
|
protected $suffix; |
20
|
|
|
|
21
|
22 |
|
public function __construct(string $message, ?int $erasingLength, Scott $style) |
22
|
|
|
{ |
23
|
22 |
|
$this->init($style); |
24
|
22 |
|
$this->updateMessage($message, $erasingLength); |
25
|
22 |
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @param string $message |
29
|
|
|
* @param null|int $erasingLength |
30
|
|
|
*/ |
31
|
22 |
|
protected function updateMessage(string $message, ?int $erasingLength): void |
32
|
|
|
{ |
33
|
22 |
|
$this->message = $this->refineMessage($message); |
34
|
22 |
|
if (Defaults::EMPTY_STRING === $this->message) { |
35
|
|
|
$this->erasingLength = 0; |
36
|
|
|
$this->suffix = Defaults::EMPTY_STRING; |
37
|
|
|
} else { |
38
|
22 |
|
$erasingLength = $this->refineErasingLen($this->message, $erasingLength); |
39
|
22 |
|
$this->erasingLength = $erasingLength; |
40
|
22 |
|
$this->suffix = Defaults::DOTS_SUFFIX; |
41
|
|
|
} |
42
|
22 |
|
$this->frameString = |
43
|
22 |
|
$this->message . $this->suffix; |
44
|
|
|
|
45
|
22 |
|
$this->currentFrameErasingLength = |
46
|
22 |
|
strlen($this->suffix . $this->spacer) + $this->erasingLength + $this->formatErasingShift; |
47
|
22 |
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @param string $message |
51
|
|
|
* @return string |
52
|
|
|
*/ |
53
|
22 |
|
protected function refineMessage(string $message): string |
54
|
|
|
{ |
55
|
22 |
|
return ucfirst($message); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @param string $message |
60
|
|
|
* @param null|int $erasingLength |
61
|
|
|
* @return int |
62
|
|
|
*/ |
63
|
22 |
|
protected function refineErasingLen(string $message, ?int $erasingLength): int |
64
|
|
|
{ |
65
|
22 |
|
if (null === $erasingLength) { |
66
|
5 |
|
return Calculator::computeErasingLength([$message]); |
67
|
|
|
} |
68
|
21 |
|
return $erasingLength; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @param string $message |
73
|
|
|
* @param null|int $erasingLength |
74
|
|
|
*/ |
75
|
4 |
|
public function setMessage(string $message, ?int $erasingLength = null): void |
76
|
|
|
{ |
77
|
4 |
|
$this->updateMessage($message, $erasingLength); |
78
|
4 |
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @return string |
82
|
|
|
*/ |
83
|
21 |
|
protected function getCurrentFrame(): string |
84
|
|
|
{ |
85
|
21 |
|
return $this->frameString; |
86
|
|
|
} |
87
|
|
|
} |
88
|
|
|
|
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