|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Koriym\AppStateDiagram; |
|
6
|
|
|
|
|
7
|
|
|
use SimpleXMLElement; |
|
8
|
|
|
|
|
9
|
|
|
use function explode; |
|
10
|
|
|
use function is_string; |
|
11
|
|
|
use function property_exists; |
|
12
|
|
|
|
|
13
|
|
|
/** @psalm-immutable */ |
|
14
|
|
|
final class Option |
|
15
|
|
|
{ |
|
16
|
|
|
/** @var bool */ |
|
17
|
|
|
public $watch; |
|
18
|
|
|
|
|
19
|
|
|
/** @var list<string> */ |
|
|
|
|
|
|
20
|
|
|
public $and; |
|
21
|
|
|
|
|
22
|
|
|
/** @var list<string> */ |
|
23
|
|
|
public $or; |
|
24
|
|
|
|
|
25
|
|
|
/** @var string */ |
|
26
|
|
|
public $color; |
|
27
|
|
|
|
|
28
|
|
|
/** @var string */ |
|
29
|
|
|
public $mode; |
|
30
|
|
|
|
|
31
|
|
|
/** @param array<string, string|bool> $options */ |
|
32
|
|
|
public function __construct(array $options, ?SimpleXMLElement $filter) |
|
33
|
|
|
{ |
|
34
|
|
|
$this->watch = isset($options['w']) || isset($options['watch']); |
|
35
|
|
|
$this->and = $this->parseAndTag($options, $filter); |
|
|
|
|
|
|
36
|
|
|
$this->or = $this->parseOrTag($options, $filter); |
|
|
|
|
|
|
37
|
|
|
$this->color = $this->parseColor($options, $filter); |
|
38
|
|
|
$this->mode = $this->getMode($options); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @param array<string, string|bool> $options |
|
43
|
|
|
* |
|
44
|
|
|
* @return list<string> |
|
45
|
|
|
*/ |
|
46
|
|
|
private function parseAndTag(array $options, ?SimpleXMLElement $filter): array |
|
47
|
|
|
{ |
|
48
|
|
|
if (isset($options['and-tag']) && is_string($options['and-tag'])) { |
|
49
|
|
|
return explode(',', $options['and-tag']); |
|
|
|
|
|
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** @var array<string> */ // phpcs:ignore SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.InvalidFormat |
|
53
|
|
|
|
|
54
|
|
|
return $filter instanceof SimpleXMLElement && property_exists($filter, 'and') ? (array) $filter->and : []; |
|
|
|
|
|
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @param array<string, string|bool> $options |
|
59
|
|
|
* |
|
60
|
|
|
* @return array<string> |
|
61
|
|
|
*/ |
|
62
|
|
|
private function parseOrTag(array $options, ?SimpleXMLElement $filter): array |
|
63
|
|
|
{ |
|
64
|
|
|
if (isset($options['or-tag']) && is_string($options['or-tag'])) { |
|
65
|
|
|
return explode(',', $options['or-tag']); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** @var array<string> */ // phpcs:ignore SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.InvalidFormat |
|
69
|
|
|
|
|
70
|
|
|
return $filter instanceof SimpleXMLElement && property_exists($filter, 'or') ? (array) $filter->or : []; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** @param array<string, string|bool> $options */ |
|
74
|
|
|
private function parseColor(array $options, ?SimpleXMLElement $filter): string |
|
75
|
|
|
{ |
|
76
|
|
|
if (isset($options['color']) && is_string($options['color'])) { |
|
77
|
|
|
return $options['color']; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
return $filter instanceof SimpleXMLElement && property_exists($filter, 'color') ? (string) $filter->color : ''; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** @param array<string, string|bool> $options */ |
|
84
|
|
|
private function getMode(array $options): string |
|
85
|
|
|
{ |
|
86
|
|
|
$isMarkdown = isset($options['mode']) && $options['mode'] === DumpDocs::MODE_MARKDOWN; |
|
87
|
|
|
|
|
88
|
|
|
return $isMarkdown ? DumpDocs::MODE_MARKDOWN : DumpDocs::MODE_HTML; |
|
89
|
|
|
} |
|
90
|
|
|
} |
|
91
|
|
|
|
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