Completed
Push — 1.x ( 0b668e...1b7ebe )
by Yuu
01:46
created

SqlLoggerProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 27
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 4 1
1
<?php
2
/**
3
 * This file is part of the Ray.DoctrineOrmModule package
4
 *
5
 * @license http://opensource.org/licenses/MIT MIT
6
 */
7
namespace Ray\DoctrineOrmModule;
8
9
use Doctrine\DBAL\Logging\SQLLogger;
10
use Psr\Log\LoggerInterface;
11
use Ray\Di\Di\Inject;
12
use Ray\Di\ProviderInterface;
13
use Ray\DoctrineOrmModule\Logger\PsrSqlLogger;
14
15
class SqlLoggerProvider implements ProviderInterface
16
{
17
    /**
18
     * @var LoggerInterface
19
     */
20
    private $logger;
21
22
    /**
23
     * Constructor.
24
     *
25
     * @param LoggerInterface $logger
26
     *
27
     * @Inject
28
     */
29 3
    public function __construct(LoggerInterface $logger)
30
    {
31 3
        $this->logger = $logger;
32 3
    }
33
34
    /**
35
     * @return SQLLogger
36
     */
37 3
    public function get()
38
    {
39 3
        return new PsrSqlLogger($this->logger);
40
    }
41
}
42