Passed
Push — master ( d55774...2498e7 )
by Caen
03:23 queued 12s
created

VendorPublishCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 18
Bugs 0 Features 0
Metric Value
eloc 10
c 18
b 0
f 0
dl 0
loc 23
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 18 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Hyde\Console\Commands;
6
7
use Illuminate\Foundation\Console\VendorPublishCommand as BaseCommand;
8
use Illuminate\Support\ServiceProvider;
9
use NunoMaduro\LaravelConsoleSummary\LaravelConsoleSummaryServiceProvider;
10
11
/**
12
 * Publish any publishable assets from vendor packages.
13
 *
14
 * @see \Hyde\Framework\Testing\Feature\Commands\VendorPublishCommandTest
15
 */
16
class VendorPublishCommand extends BaseCommand
17
{
18
    /**
19
     * Our child method filters the options available to the parent method.
20
     */
21
    public function handle(): void
22
    {
23
        $originalPublishers = ServiceProvider::$publishes;
24
        $originalGroups = ServiceProvider::$publishGroups;
25
26
        // This provider's publisher is not needed as it's covered by Laravel Zero
27
        unset(ServiceProvider::$publishes[LaravelConsoleSummaryServiceProvider::class]);
28
29
        // Rename the config group to be more helpful
30
        if (isset(ServiceProvider::$publishGroups['config'])) {
31
            ServiceProvider::$publishGroups['vendor-configs'] = ServiceProvider::$publishGroups['config'];
32
            unset(ServiceProvider::$publishGroups['config']);
33
        }
34
35
        parent::handle();
36
37
        ServiceProvider::$publishes = $originalPublishers;
38
        ServiceProvider::$publishGroups = $originalGroups;
39
    }
40
}
41