Skip to content

Commit

Permalink
Fix code style, rename canRegisterMiddelware -> shouldRegisterMiddlew…
Browse files Browse the repository at this point in the history
…are.
  • Loading branch information
maantje committed Jul 15, 2024
1 parent e17d29a commit a8c63ab
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/XhprofServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@ public function register(): void
{
$this->mergeConfigFrom(__DIR__.'/../config/xhprof.php', 'xhprof');

if (!$this->isEnabled()) {
if (! $this->isEnabled()) {
return;
}

if ($this->canRegisterMiddleware()) {
if ($this->shouldRegisterMiddleware()) {
$this->registerMiddleware();
}

$this->app->bind(Profiler::class, function () {
$storage = new WebStorage(
new CurlHttpClient(),
config('xhprof.endpoint'),
new CurlHttpClient(),
config('xhprof.endpoint'),
);

return new Profiler(
$storage,
DriverFactory::createXhrofDriver(),
config('app.name')
$storage,
DriverFactory::createXhrofDriver(),
config('app.name')
);
});
}
Expand All @@ -50,8 +50,8 @@ protected function registerMiddleware(): void
$kernel = $this->app->get(Kernel::class);

if (
method_exists($kernel, 'hasMiddleware')
&& $kernel->hasMiddleware(XhprofProfiler::class)
method_exists($kernel, 'hasMiddleware')
&& $kernel->hasMiddleware(XhprofProfiler::class)
) {
return;
}
Expand All @@ -65,7 +65,7 @@ protected function registerMiddleware(): void
public function boot(): void
{
$this->publishes([
__DIR__.'/../config/xhprof.php' => config_path('xhprof.php'),
__DIR__.'/../config/xhprof.php' => config_path('xhprof.php'),
]);
}

Expand All @@ -85,7 +85,7 @@ private function isEnabled(): bool
}
}

private function canRegisterMiddleware(): bool
private function shouldRegisterMiddleware(): bool
{
try {
return config()->get('xhprof.register_middleware');
Expand Down

0 comments on commit a8c63ab

Please sign in to comment.