Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| SparseVector | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toArray | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Mbvb1223\Pinecone\Data\Vectors; |
| 6 | |
| 7 | class SparseVector |
| 8 | { |
| 9 | /** |
| 10 | * @param array<int> $indices |
| 11 | * @param array<float> $values |
| 12 | */ |
| 13 | public function __construct( |
| 14 | public readonly array $indices, |
| 15 | public readonly array $values, |
| 16 | ) { |
| 17 | } |
| 18 | |
| 19 | /** @return array{indices: array<int>, values: array<float>} */ |
| 20 | public function toArray(): array |
| 21 | { |
| 22 | return ['indices' => $this->indices, 'values' => $this->values]; |
| 23 | } |
| 24 | } |