Test Failed
Pull Request — stable (#292)
by Victor
04:05 queued 01:37
created

Installer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 13
dl 0
loc 35
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
    public function install(): void
43
    {
44
        $this->require('zendframework/zend-text "^2.7"');
45
46
        $this->task(
47
            'Creating default logo configuration',
48
            function () {
49
                if (! File::exists(config_path('logo.php'))) {
50
                    return File::copy(
51
                        static::CONFIG_FILE,
52
                        $this->app->configPath('logo.php')
53
                    );
54
                }
55
56
                return false;
57
            }
58
        );
59
    }
60
}
61