Completed
Push — master ( 7f96b3...40f202 )
by Dmitry
03:32
created

Logging   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 22
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 14 1
1
<?php
2
3
namespace Basis\Providers;
4
5
use Basis\Config;
6
use Basis\Logger;
7
use Fluent\Logger\FluentLogger;
8
use League\Container\ServiceProvider\AbstractServiceProvider;
9
10
class Logging extends AbstractServiceProvider
11
{
12
    protected $provides = [
13
        FluentLogger::class,
14
        Logger::class,
15
    ];
16
17 1
    public function register()
18
    {
19
        $this->container->share(FluentLogger::class, function() {
20
            $config = $this->container->get(Config::class);
21
            return new FluentLogger($config['fluent.host'], $config['fluent.port']);
22 1
        });
23
24 1
        $this->container->share(Logger::class, function() {
25 1
            $fluent = $this->container->get(FluentLogger::class);
26 1
            $config = $this->container->get(Config::class);
27 1
            return new Logger($fluent, $config['app.name']);
28 1
        });
29
30
    }
31
}