ContainerBench   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A benchFactory() 0 3 1
A init() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
use Gravatalonga\Container\Container;
6
7
/**
8
 * @Revs({1, 8, 64, 4096})
9
 * @BeforeMethods({"init"})
10
 */
11
class ContainerBench
12
{
13
    /**
14
     * @var Container
15
     */
16
    private $container;
17
18
    /**
19
     * @Iterations(5)
20
     */
21
    public function benchFactory()
22
    {
23
        $this->container->get('my-logger');
24
    }
25
26
    public function init()
27
    {
28
        $this->container = new Container();
29
        $this->container->set('my-logger', static function () {
30
            return mt_rand(0, 1000);
31
        });
32
    }
33
}
34