Passed
Push — phpbench ( ffc4ab )
by Michael
02:36
created

CachedReadPerformanceWithInMemoryBench   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 21
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A initialize() 0 4 1
A bench() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Performance\Annotations;
6
7
use Doctrine\Annotations\AnnotationReader;
8
use Doctrine\Annotations\CachedReader;
9
use Doctrine\Common\Cache\ArrayCache;
10
use Doctrine\Tests\Annotations\Fixtures\Controller;
11
use ReflectionMethod;
12
13
/**
14
 * @BeforeMethods({"initialize"})
15
 */
16
final class CachedReadPerformanceWithInMemoryBench
17
{
18
    /** @var CachedReader */
19
    private $reader;
20
21
    /** @var ReflectionMethod */
22
    private $method;
23
24
    public function initialize() : void
25
    {
26
        $this->reader = new CachedReader(new AnnotationReader(), new ArrayCache());
27
        $this->method = new ReflectionMethod(Controller::class, 'helloAction');
28
    }
29
30
    /**
31
     * @Revs(500)
32
     * @Iterations(5)
33
     */
34
    public function bench() : void
35
    {
36
        $this->reader->getMethodAnnotations($this->method);
37
    }
38
}
39