|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
namespace Tohidplus\Paravel\Response; |
|
5
|
|
|
|
|
6
|
|
|
|
|
7
|
|
|
use Illuminate\Support\Collection; |
|
|
|
|
|
|
8
|
|
|
use Tohidplus\Paravel\Process\Process; |
|
9
|
|
|
|
|
10
|
|
|
class ResponseList |
|
11
|
|
|
{ |
|
12
|
|
|
protected Collection $responses; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* ResponseList constructor. |
|
16
|
|
|
* @param array $responses |
|
17
|
|
|
*/ |
|
18
|
|
|
public function __construct(array $responses) |
|
19
|
|
|
{ |
|
20
|
|
|
$this->responses = collect($responses); |
|
|
|
|
|
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @param string $label |
|
25
|
|
|
* @return array |
|
26
|
|
|
*/ |
|
27
|
|
|
public function get(string $label) |
|
28
|
|
|
{ |
|
29
|
|
|
return $this->responses->where('label', $label)->first(); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @param string $label |
|
34
|
|
|
* @return mixed|null |
|
35
|
|
|
*/ |
|
36
|
|
|
public function resultOf(string $label) |
|
37
|
|
|
{ |
|
38
|
|
|
return $this->get($label)['result'] ?? null; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @param string $label |
|
43
|
|
|
* @return mixed|null |
|
44
|
|
|
*/ |
|
45
|
|
|
public function errorOf(string $label) |
|
46
|
|
|
{ |
|
47
|
|
|
return $this->get($label)['error'] ?? null; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @param string $label |
|
52
|
|
|
* @return mixed|null |
|
53
|
|
|
*/ |
|
54
|
|
|
public function statusOf(string $label) |
|
55
|
|
|
{ |
|
56
|
|
|
return $this->get($label)['status'] ?? null; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @param Process $process |
|
61
|
|
|
*/ |
|
62
|
|
|
public function add(Process $process) |
|
63
|
|
|
{ |
|
64
|
|
|
$response = new Response(...$this->getResponseArguments($process)); |
|
|
|
|
|
|
65
|
|
|
$this->responses->add($response->toArray()); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @return bool |
|
70
|
|
|
*/ |
|
71
|
|
|
public function succeeded(): bool |
|
72
|
|
|
{ |
|
73
|
|
|
return !$this->responses->where('status', '=', false)->count(); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* @return bool |
|
78
|
|
|
*/ |
|
79
|
|
|
public function failed(): bool |
|
80
|
|
|
{ |
|
81
|
|
|
return !$this->succeeded(); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* @param Process $process |
|
87
|
|
|
* @return array |
|
88
|
|
|
*/ |
|
89
|
|
|
private function getResponseArguments(Process $process): array |
|
90
|
|
|
{ |
|
91
|
|
|
if ($process->isSuccessful()) { |
|
|
|
|
|
|
92
|
|
|
return [$process->label(), true, $process->getOutput()]; |
|
93
|
|
|
} |
|
94
|
|
|
return [$process->label(), false, null, ['output' => $process->getOutput()]]; |
|
95
|
|
|
} |
|
96
|
|
|
} |
|
97
|
|
|
|
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