| 1 | <?php |
||
| 2 | |||
| 3 | use Onnov\DetectEncoding\EncodingDetector; |
||
| 4 | use PhpBench\Benchmark\Metadata\Annotations\Iterations; |
||
| 5 | use PhpBench\Benchmark\Metadata\Annotations\ParamProviders; |
||
| 6 | use PhpBench\Benchmark\Metadata\Annotations\Revs; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Class GetEncodingBench |
||
| 10 | */ |
||
| 11 | class GetEncodingBench |
||
|
0 ignored issues
–
show
|
|||
| 12 | { |
||
| 13 | /** @var EncodingDetector */ |
||
| 14 | private $encodingDetector; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * GetEncodingBench constructor. |
||
| 18 | */ |
||
| 19 | public function __construct() |
||
| 20 | { |
||
| 21 | $this->encodingDetector = new EncodingDetector(); |
||
| 22 | } |
||
| 23 | |||
| 24 | |||
| 25 | public function textProvider() |
||
| 26 | { |
||
| 27 | yield ['Проверяемый текст']; |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @Revs(1000) |
||
| 32 | * @Iterations(5) |
||
| 33 | * @ParamProviders({"textProvider"}) |
||
| 34 | * @param array $textArray |
||
| 35 | */ |
||
| 36 | public function benchGetEncoding(array $textArray) |
||
| 37 | { |
||
| 38 | $this->encodingDetector->getEncoding($textArray[0]); |
||
| 39 | } |
||
| 40 | } |
||
| 41 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.