GetEncodingBench   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A textProvider() 0 3 1
A __construct() 0 3 1
A benchGetEncoding() 0 3 1
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