1 | <?php |
||
2 | |||
3 | namespace Bdf\Prime\Query\Extension; |
||
4 | |||
5 | use Bdf\Prime\Collection\CollectionInterface; |
||
6 | use Bdf\Prime\Connection\Result\ResultSetInterface; |
||
7 | use Bdf\Prime\Exception\PrimeException; |
||
8 | use Bdf\Prime\Query\Contract\ReadOperation; |
||
9 | use Bdf\Prime\Query\QueryInterface; |
||
10 | |||
11 | /** |
||
12 | * Trait for provide execute() wrapper methods |
||
13 | * |
||
14 | * @psalm-require-implements \Bdf\Prime\Query\ReadCommandInterface |
||
15 | */ |
||
16 | trait ExecutableTrait |
||
17 | { |
||
18 | /** |
||
19 | * {@inheritdoc} |
||
20 | * @see QueryInterface::all() |
||
21 | */ |
||
22 | #[ReadOperation] |
||
23 | 525 | public function all($columns = null) |
|
24 | { |
||
25 | 525 | return $this->postProcessResult($this->execute($columns)); |
|
26 | } |
||
27 | |||
28 | /** |
||
29 | * {@inheritdoc} |
||
30 | * @see QueryInterface::first() |
||
31 | */ |
||
32 | #[ReadOperation] |
||
33 | 267 | public function first($columns = null) |
|
34 | { |
||
35 | 267 | foreach ($this->limit(1)->all($columns) as $entity) { |
|
36 | 251 | return $entity; |
|
37 | } |
||
38 | |||
39 | 56 | return null; |
|
40 | } |
||
41 | |||
42 | /** |
||
43 | * {@inheritdoc} |
||
44 | * @see QueryInterface::inRows() |
||
45 | * |
||
46 | * @return list<mixed> |
||
0 ignored issues
–
show
|
|||
47 | */ |
||
48 | #[ReadOperation] |
||
49 | 40 | public function inRows(string $column): array |
|
50 | { |
||
51 | 40 | return $this->execute($column)->asColumn()->all(); |
|
0 ignored issues
–
show
|
|||
52 | } |
||
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | * @see QueryInterface::inRow() |
||
57 | */ |
||
58 | #[ReadOperation] |
||
59 | 7 | public function inRow(string $column) |
|
60 | { |
||
61 | 7 | foreach ($this->limit(1)->execute($column)->asColumn() as $value) { |
|
62 | 7 | return $value; |
|
63 | } |
||
64 | |||
65 | return null; |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * Post processors. |
||
70 | * Wrap data with defined wrapper. Run the post processors on rows |
||
71 | * |
||
72 | * @param ResultSetInterface<array<string, mixed>> $data |
||
73 | * |
||
74 | * @return array|CollectionInterface |
||
75 | */ |
||
76 | abstract public function postProcessResult(ResultSetInterface $data): iterable; |
||
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | * |
||
81 | * @return ResultSetInterface<array<string, mixed>> |
||
82 | * |
||
83 | * @see QueryInterface::execute() |
||
84 | * @throws PrimeException |
||
85 | */ |
||
86 | #[ReadOperation] |
||
87 | abstract public function execute($columns = null): ResultSetInterface; |
||
88 | |||
89 | /** |
||
90 | * {@inheritdoc} |
||
91 | * |
||
92 | * @see QueryInterface::limit() |
||
93 | */ |
||
94 | abstract public function limit(?int $limit, ?int $offset = null); |
||
95 | } |
||
96 |
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