Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| IndexesWords | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| getIndexes | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\Core\ValueObjects\Concerns; |
| 3 | |
| 4 | use Apie\Core\Attributes\ProvideIndex; |
| 5 | use Apie\Core\ValueObjects\IsStringValueObject; |
| 6 | use Apie\CountWords\WordCounter; |
| 7 | |
| 8 | /** |
| 9 | * Put this attribute on your string value object and we will count the words in the string. |
| 10 | * #[ProvideIndex('getIndexes')] |
| 11 | * @see IsStringValueObject |
| 12 | * @see ProvideIndex |
| 13 | */ |
| 14 | trait IndexesWords |
| 15 | { |
| 16 | /** |
| 17 | * @return array<string, int> |
| 18 | */ |
| 19 | public function getIndexes(): array |
| 20 | { |
| 21 | return WordCounter::countFromString($this->internal); |
| 22 | } |
| 23 | } |