GetEncodingBench::textProvider()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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