Provider::isAvailable()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This file is part of Laravel Zero.
7
 *
8
 * (c) Nuno Maduro <[email protected]>
9
 *
10
 *  For the full copyright and license information, please view the LICENSE
11
 *  file that was distributed with this source code.
12
 */
13
14
namespace LaravelZero\Framework\Components\Log;
15
16
use function class_exists;
17
use LaravelZero\Framework\Components\AbstractComponentProvider;
18
19
/**
20
 * @internal
21
 */
22
final class Provider extends AbstractComponentProvider
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27 39
    public function isAvailable(): bool
28
    {
29 39
        return class_exists(\Illuminate\Log\LogServiceProvider::class)
30 39
            && $this->app['config']->get('logging.useDefaultProvider', true) === true;
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 39
    public function register(): void
37
    {
38 39
        $this->app->register(\Illuminate\Log\LogServiceProvider::class);
39
40 39
        $config = $this->app['config'];
41
42 39
        $config->set('logging.default', $config->get('logging.default') ?: 'default');
43 39
    }
44
}
45