1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
/** |
5
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
6
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
7
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
8
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
9
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
10
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
11
|
|
|
* THE SOFTWARE. |
12
|
|
|
* |
13
|
|
|
* This software consists of voluntary contributions made by many individuals |
14
|
|
|
* and is licensed under the MIT license. |
15
|
|
|
* |
16
|
|
|
* Copyright (c) 2015-2020 Yuuki Takezawa |
17
|
|
|
* |
18
|
|
|
*/ |
19
|
|
|
namespace Ytake\LaravelAspect; |
20
|
|
|
|
21
|
|
|
use Illuminate\Contracts\Support\DeferrableProvider; |
22
|
|
|
use Illuminate\Support\ServiceProvider; |
23
|
|
|
use Ytake\LaravelAspect\Console\CompileCommand; |
24
|
|
|
use Ytake\LaravelAspect\Console\ClearCacheCommand; |
25
|
|
|
use Ytake\LaravelAspect\Console\ModulePublishCommand; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Class ConsoleServiceProvider |
29
|
|
|
*/ |
30
|
|
|
class ConsoleServiceProvider extends ServiceProvider implements DeferrableProvider |
31
|
|
|
{ |
32
|
|
|
public function boot(): void |
33
|
|
|
{ |
34
|
|
|
$this->registerCommands(); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @return void |
39
|
|
|
*/ |
40
|
|
|
protected function registerCommands(): void |
41
|
|
|
{ |
42
|
|
|
$this->app->singleton('command.ytake.aspect.clear-cache', function ($app) { |
43
|
|
|
return new ClearCacheCommand($app['config'], $app['files']); |
44
|
|
|
}); |
45
|
|
|
$this->app->singleton('command.ytake.aspect.module-publish', function ($app) { |
46
|
|
|
return new ModulePublishCommand($app['files']); |
47
|
|
|
}); |
48
|
|
|
$this->app->singleton('command.ytake.aspect.compile', function ($app) { |
49
|
|
|
return new CompileCommand($app['aspect.manager']); |
50
|
|
|
}); |
51
|
|
|
$this->commands([ |
52
|
|
|
'command.ytake.aspect.clear-cache', |
53
|
|
|
'command.ytake.aspect.module-publish', |
54
|
|
|
'command.ytake.aspect.compile' |
55
|
|
|
]); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* {@inheritdoc} |
60
|
|
|
*/ |
61
|
|
|
public function provides() |
62
|
|
|
{ |
63
|
|
|
return [ |
64
|
|
|
'command.ytake.aspect.clear-cache', |
65
|
|
|
'command.ytake.aspect.module-publish', |
66
|
|
|
'command.ytake.aspect.compile' |
67
|
|
|
]; |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|