1 | <?php |
||||||
2 | |||||||
3 | namespace BeyondCode\DumpServer; |
||||||
4 | |||||||
5 | use Illuminate\Support\ServiceProvider; |
||||||
6 | use Symfony\Component\VarDumper\VarDumper; |
||||||
7 | use Symfony\Component\VarDumper\Server\Connection; |
||||||
8 | use Symfony\Component\VarDumper\Server\DumpServer; |
||||||
9 | use Symfony\Component\VarDumper\Dumper\ContextProvider\SourceContextProvider; |
||||||
10 | |||||||
11 | class DumpServerServiceProvider extends ServiceProvider |
||||||
12 | { |
||||||
13 | /** |
||||||
14 | * Bootstrap the application services. |
||||||
15 | * |
||||||
16 | * @return void |
||||||
17 | */ |
||||||
18 | public function boot() |
||||||
19 | { |
||||||
20 | if ($this->app->runningInConsole()) { |
||||||
21 | |||||||
22 | $this->publishes([ |
||||||
23 | __DIR__.'/../config/config.php' => config_path('debug-server.php'), |
||||||
24 | ], 'config'); |
||||||
25 | } |
||||||
26 | } |
||||||
27 | |||||||
28 | /** |
||||||
29 | * Register the application services. |
||||||
30 | * |
||||||
31 | * @return void |
||||||
32 | */ |
||||||
33 | public function register() |
||||||
34 | { |
||||||
35 | $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'debug-server'); |
||||||
36 | |||||||
37 | $this->app->bind('command.dumpserver', DumpServerCommand::class); |
||||||
38 | |||||||
39 | $this->commands([ |
||||||
40 | 'command.dumpserver', |
||||||
41 | ]); |
||||||
42 | |||||||
43 | $host = $this->app['config']->get('debug-server.host'); |
||||||
44 | |||||||
45 | $this->app->when(DumpServer::class)->needs('$host')->give($host); |
||||||
46 | |||||||
47 | $connection = new Connection($host, [ |
||||||
48 | 'request' => new RequestContextProvider($this->app['request']), |
||||||
49 | 'source' => new SourceContextProvider('utf-8', base_path()), |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
50 | ]); |
||||||
51 | |||||||
52 | VarDumper::setHandler(function ($var) use ($connection) { |
||||||
53 | $this->app->makeWith(Dumper::class, ['connection' => $connection])->dump($var); |
||||||
0 ignored issues
–
show
The method
makeWith() does not exist on Illuminate\Contracts\Foundation\Application .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||
54 | }); |
||||||
55 | } |
||||||
56 | } |
||||||
57 |