Passed
Push — master ( 78b346...e9f486 )
by Carlos
02:47
created

LogServiceProvider::formatLogConfig()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 28
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 4
eloc 18
c 2
b 0
f 0
nc 3
nop 1
dl 0
loc 28
rs 9.6666
1
<?php
2
3
/*
4
 * This file is part of the overtrue/wechat.
5
 *
6
 * (c) overtrue <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace EasyWeChat\Kernel\Providers;
13
14
use EasyWeChat\Kernel\Log\LogManager;
15
use Pimple\Container;
16
use Pimple\ServiceProviderInterface;
17
18
/**
19
 * Class LoggingServiceProvider.
20
 *
21
 * @author overtrue <[email protected]>
22
 */
23
class LogServiceProvider implements ServiceProviderInterface
24
{
25
    /**
26
     * Registers services on the given container.
27
     *
28
     * This method should only be used to configure services and parameters.
29
     * It should not get services.
30
     *
31
     * @param Container $pimple A container instance
32
     */
33
    public function register(Container $pimple)
34
    {
35
        !isset($pimple['log']) && $pimple['log'] = function ($app) {
36
            $config = $app['config']->get('log');
37
38
            if (!empty($config)) {
39
                $app->rebind('config', $app['config']->merge($config));
40
            }
41
42
            return new LogManager($app);
43
        };
44
45
        !isset($pimple['logger']) && $pimple['logger'] = $pimple['log'];
46
    }
47
}
48