Test Failed
Push — stable ( e76163...9c661a )
by Nuno
02:41
created

Installer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 88.89%

Importance

Changes 0
Metric Value
wmc 2
eloc 13
dl 0
loc 35
ccs 8
cts 9
cp 0.8889
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A install() 0 15 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 Illuminate\Support\Facades\File;
17
use LaravelZero\Framework\Components\AbstractInstaller;
18
19
/**
20
 * @internal
21
 */
22
final class Installer extends AbstractInstaller
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    protected $name = 'install:logo';
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    protected $description = 'Logo: Display app name as ASCII logo';
33
34
    /**
35
     * The config file path.
36
     */
37
    private const CONFIG_FILE = __DIR__.DIRECTORY_SEPARATOR.'stubs'.DIRECTORY_SEPARATOR.'logo.php';
38
39
    /**
40
     * {@inheritdoc}
41
     */
42 2
    public function install(): void
43
    {
44 2
        $this->require('zendframework/zend-text "^2.7"');
45
46 2
        $this->task(
47 2
            'Creating default logo configuration',
48
            function () {
49 2
                if (! File::exists(config_path('logo.php'))) {
50 2
                    return File::copy(
51 2
                        static::CONFIG_FILE,
52 2
                        $this->app->configPath('logo.php')
53
                    );
54
                }
55
56
                return false;
57 2
            }
58
        );
59 2
    }
60
}
61