Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
UseResourceForFile
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 countFromFile
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2namespace Apie\CountWords\Strategies\Concerns;
3
4trait UseResourceForFile
5{
6    public static function countFromFile(string $path, array $counts = []): array
7    {
8        $handle = fopen($path, 'r+');
9        try {
10            return self::countFromResource($handle, $counts);
11        } finally {
12            fclose($handle);
13        }
14    }
15}