1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Koriym\AppStateDiagram; |
6
|
|
|
|
7
|
|
|
use Koriym\AppStateDiagram\Exception\InvalidSemanticsException; |
8
|
|
|
use stdClass; |
9
|
|
|
|
10
|
|
|
use function assert; |
11
|
|
|
use function explode; |
12
|
|
|
use function is_string; |
13
|
|
|
use function json_encode; |
14
|
|
|
use function property_exists; |
15
|
|
|
use function sprintf; |
16
|
|
|
|
17
|
|
|
abstract class AbstractDescriptor |
18
|
|
|
{ |
19
|
|
|
/** @var string */ |
20
|
|
|
public $id; |
21
|
|
|
|
22
|
|
|
/** @var ?string */ |
23
|
|
|
public $def; |
24
|
|
|
|
25
|
|
|
/** @var stdClass|null */ |
26
|
|
|
public $doc; |
27
|
|
|
|
28
|
|
|
/** @var list<stdClass> */ |
|
|
|
|
29
|
|
|
public $descriptor; |
30
|
|
|
|
31
|
|
|
/** @var string */ |
32
|
|
|
public $type = 'semantic'; |
33
|
|
|
|
34
|
|
|
/** @var ?string */ |
35
|
|
|
public $rel; |
36
|
|
|
|
37
|
|
|
/** @var stdClass|SemanticDescriptor|null */ |
38
|
|
|
public $parent; |
39
|
|
|
|
40
|
|
|
/** @var list<string> */ |
41
|
|
|
public $tags; |
42
|
|
|
|
43
|
|
|
/** @var string */ |
44
|
|
|
public $title; |
45
|
|
|
|
46
|
|
|
/** @var object */ |
47
|
|
|
public $source; |
48
|
|
|
|
49
|
|
|
/** @var string|null */ |
50
|
|
|
public $href; |
51
|
|
|
|
52
|
|
|
/** @var LinkRelations */ |
53
|
|
|
public $linkRelations; |
54
|
|
|
|
55
|
|
|
public function __construct(object $descriptor, ?stdClass $parentDescriptor = null) |
56
|
|
|
{ |
57
|
|
|
if (! isset($descriptor->id)) { |
58
|
|
|
throw new InvalidSemanticsException((string) json_encode($descriptor)); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
$this->source = $descriptor; |
|
|
|
|
62
|
|
|
$this->id = (string) $descriptor->id; |
63
|
|
|
/** @psalm-suppress MixedAssignment */ |
64
|
|
|
$this->def = $descriptor->def ?? $descriptor->ref ?? $descriptor->src ?? null; |
65
|
|
|
/** @psalm-suppress MixedAssignment */ |
66
|
|
|
$this->doc = $descriptor->doc ?? null; |
67
|
|
|
/** @psalm-suppress MixedAssignment */ |
68
|
|
|
$this->descriptor = $descriptor->descriptor ?? []; |
|
|
|
|
69
|
|
|
$this->parent = $parentDescriptor; |
70
|
|
|
/** @var string|list<string> $tag */ |
71
|
|
|
$tag = $descriptor->tag ?? []; |
72
|
|
|
/** @psalm-suppress MixedAssignment */ |
73
|
|
|
$this->tags = is_string($tag) ? explode(' ', $tag) : $tag; |
|
|
|
|
74
|
|
|
/** @psalm-suppress MixedAssignment */ |
75
|
|
|
$this->title = $descriptor->title ?? ''; |
76
|
|
|
if (isset($descriptor->rel)) { |
77
|
|
|
$this->rel = (string) $descriptor->rel; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
if (property_exists($descriptor, 'href')) { |
81
|
|
|
assert(is_string($descriptor->href) || $descriptor->href === null); |
82
|
|
|
$this->href = $descriptor->href; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** @psalm-suppress all */ |
86
|
|
|
$this->linkRelations = new LinkRelations($descriptor->link ?? null); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function htmlLink(string $ext): string |
90
|
|
|
{ |
91
|
|
|
return sprintf('[%s](%s.%s.%s)', $this->id, $this->type, $this->id, $ext); |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|
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