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

VendorPublishCommand::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 18
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 6
Bugs 0 Features 0
Metric Value
cc 2
eloc 9
c 6
b 0
f 0
nc 2
nop 0
dl 0
loc 18
rs 9.9666
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