refactor: susun semula struktur folder — Laravel source ke src/
This commit is contained in:
46
vendor/laravel/pao/src/Laravel/ServiceProvider.php
vendored
Normal file
46
vendor/laravel/pao/src/Laravel/ServiceProvider.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laravel\Pao\Laravel;
|
||||
|
||||
use Illuminate\Console\Events\CommandStarting;
|
||||
use Illuminate\Console\OutputStyle;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
|
||||
use Laravel\AgentDetector\AgentDetector;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
final class ServiceProvider extends LaravelServiceProvider
|
||||
{
|
||||
public function boot(): void
|
||||
{
|
||||
if (isset($_SERVER['PAO_DISABLE'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (! $this->app->runningInConsole()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->app->runningUnitTests()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (! AgentDetector::detect()->isAgent) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->app->bind(OutputStyle::class, PaoOutputStyle::class);
|
||||
|
||||
/** @var Dispatcher $events */
|
||||
$events = $this->app->make(Dispatcher::class);
|
||||
$events->listen(CommandStarting::class, function (CommandStarting $event): void {
|
||||
$event->output->setDecorated(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user