tohidplus /
paravel
| 1 | <?php |
||||
| 2 | |||||
| 3 | |||||
| 4 | namespace Tohidplus\Paravel\Response; |
||||
| 5 | |||||
| 6 | |||||
| 7 | use Illuminate\Support\Collection; |
||||
|
0 ignored issues
–
show
|
|||||
| 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); |
||||
|
0 ignored issues
–
show
The function
collect was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 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)); |
||||
|
0 ignored issues
–
show
The call to
Tohidplus\Paravel\Response\Response::__construct() has too few arguments starting with status.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. Loading history...
|
|||||
| 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()) { |
||||
|
0 ignored issues
–
show
The method
isSuccessful() does not exist on Tohidplus\Paravel\Process\Process. Since you implemented __call, consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 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