Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
75.00% |
3 / 4 |
|
66.67% |
2 / 3 |
CRAP | |
0.00% |
0 / 1 |
| SearchTerm | |
75.00% |
3 / 4 |
|
66.67% |
2 / 3 |
3.14 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| __toString | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| hasSearchTerms | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\IntegrationTests; |
| 3 | |
| 4 | use Apie\CountWords\WordCounter; |
| 5 | use Stringable; |
| 6 | |
| 7 | final class SearchTerm implements Stringable |
| 8 | { |
| 9 | public function __construct(private readonly string $searchTerm) |
| 10 | { |
| 11 | } |
| 12 | |
| 13 | public function __toString(): string |
| 14 | { |
| 15 | return $this->searchTerm; |
| 16 | } |
| 17 | |
| 18 | public function hasSearchTerms(): bool |
| 19 | { |
| 20 | $words = WordCounter::countFromString($this->searchTerm); |
| 21 | |
| 22 | return count($words) > 0; |
| 23 | } |
| 24 | } |