| Code Coverage | ||||||||||
| Lines | Functions and Methods | Classes and Traits | ||||||||
| Total |  | 100.00% | 2 / 2 |  | 100.00% | 2 / 2 | CRAP |  | 100.00% | 1 / 1 | 
| PlaintextWordCounter |  | 100.00% | 2 / 2 |  | 100.00% | 2 / 2 | 4 |  | 100.00% | 1 / 1 | 
| __construct | n/a | 0 / 0 | n/a | 0 / 0 | 1 | |||||
| isSupported |  | 100.00% | 1 / 1 |  | 100.00% | 1 / 1 | 2 | |||
| countFromString |  | 100.00% | 1 / 1 |  | 100.00% | 1 / 1 | 1 | |||
| 1 | <?php | 
| 2 | namespace Apie\CountWords\Strategies; | 
| 3 | |
| 4 | use Apie\CountWords\Strategies\Concerns\UseResourceForFile; | 
| 5 | use Apie\CountWords\Strategies\Concerns\UseStringForResource; | 
| 6 | use Apie\CountWords\WordCounter; | 
| 7 | |
| 8 | final class PlaintextWordCounter implements WordCounterInterface | 
| 9 | { | 
| 10 | use UseStringForResource; | 
| 11 | use UseResourceForFile; | 
| 12 | /** | 
| 13 | * @codeCoverageIgnore | 
| 14 | */ | 
| 15 | private function __construct() | 
| 16 | { | 
| 17 | } | 
| 18 | |
| 19 | public static function isSupported(?string $fileExtension, ?string $mimeType): bool | 
| 20 | { | 
| 21 | return in_array($fileExtension, ['txt', 'log']) || in_array($mimeType, ['text/plain']); | 
| 22 | } | 
| 23 | |
| 24 | public static function countFromString(string $text, array $counts = []): array | 
| 25 | { | 
| 26 | return WordCounter::countFromString($text, $counts); | 
| 27 | } | 
| 28 | } |