Issues (2)

benchmarks/GetEncodingBench.php (1 issue)

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
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
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