Provider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 33.33%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
eloc 8
c 2
b 0
f 0
dl 0
loc 24
rs 10
ccs 3
cts 9
cp 0.3333

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isAvailable() 0 4 2
A register() 0 9 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\Logo;
15
16
use function class_exists;
17
use Illuminate\Console\Application as Artisan;
18
use LaravelZero\Framework\Components\AbstractComponentProvider;
19
20
/**
21
 * @internal
22
 */
23
final class Provider extends AbstractComponentProvider
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28 39
    public function isAvailable(): bool
29
    {
30 39
        return class_exists(\Zend\Text\Figlet\Figlet::class) && is_array(
31 39
                $this->app['config']->get('logo', false)
32
            );
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function register(): void
39
    {
40
        $config = $this->app['config'];
41
42
        if ($config->get('logo.enabled', false)) {
43
            Artisan::starting(
44
                function ($artisan) use ($config) {
45
                    $artisan->setName(
46
                        new FigletString($config->get('app.name'), $config->get('logo', []))
47
                    );
48
                }
49
            );
50
        }
51
    }
52
}
53