Completed
Push — 1.x ( f905e8...4312fb )
by Akihito
25s queued 10s
created

ProfilerProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ray\AuraSqlModule;
6
7
use Aura\Sql\Profiler\Profiler;
8
use Psr\Log\LoggerInterface;
9
use Ray\Di\Provider;
10
11
class ProfilerProvider implements Provider
12
{
13
    /** @var LoggerInterface */
14
    private $logger;
15
16
    public function __construct(LoggerInterface $logger)
17
    {
18
        $this->logger = $logger;
19
    }
20
21
    public function get(): Profiler
22
    {
23
        $profiler = new Profiler($this->logger);
24
        $profiler->setLogFormat('{duration}: {function} {statement}:{values}');
25
        $profiler->setActive(true);
26
27
        return $profiler;
28
    }
29
}
30