-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppBootstrapBuilder.php
More file actions
41 lines (30 loc) · 1.2 KB
/
AppBootstrapBuilder.php
File metadata and controls
41 lines (30 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace RonasIT\Larabuilder\Builders;
use RonasIT\Larabuilder\ValueOptions\ScheduleOption;
use RonasIT\Larabuilder\Visitors\AppBootstrapVisitors\AddExceptionsRender;
use RonasIT\Larabuilder\Visitors\AppBootstrapVisitors\AddScheduleCommand;
class AppBootstrapBuilder extends PHPFileBuilder
{
public function __construct(string $filePath = 'bootstrap/app.php')
{
parent::__construct($filePath);
}
public function addExceptionsRender(string $exceptionClass, string $renderBody, bool $includeRequestArg = false): self
{
$this->traverser->addVisitor(new AddExceptionsRender($exceptionClass, $renderBody, $includeRequestArg));
$imports = ['Illuminate\Foundation\Configuration\Exceptions', $exceptionClass];
if ($includeRequestArg) {
$imports[] = 'Illuminate\Http\Request';
}
$this->addImports($imports);
return $this;
}
public function addScheduleCommand(string $command, ScheduleOption ...$options): self
{
$this->traverser->addVisitor(new AddScheduleCommand($command, ...$options));
$this->addImports([
'Illuminate\Support\Facades\Schedule',
]);
return $this;
}
}