for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Providers;
use App\Services\Search\Contracts\SearchServiceInterface;
use App\Services\Search\ElasticSearchService;
use App\Services\Search\ManticoreSearchService;
use Illuminate\Support\ServiceProvider;
class SearchServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
// Register ManticoreSearchService as singleton
$this->app->singleton(ManticoreSearchService::class, function ($app) {
$app
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
$this->app->singleton(ManticoreSearchService::class, function (/** @scrutinizer ignore-unused */ $app) {
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
return new ManticoreSearchService();
});
// Register ElasticSearchService as singleton
$this->app->singleton(ElasticSearchService::class, function ($app) {
$this->app->singleton(ElasticSearchService::class, function (/** @scrutinizer ignore-unused */ $app) {
return new ElasticSearchService();
// Bind the interface to the appropriate implementation based on config
$this->app->singleton(SearchServiceInterface::class, function ($app) {
if (config('nntmux.elasticsearch_enabled') === true) {
return $app->make(ElasticSearchService::class);
}
return $app->make(ManticoreSearchService::class);
// Register alias for ManticoreSearch (for backward compatibility)
$this->app->alias(ManticoreSearchService::class, 'manticore');
* Bootstrap any application services.
public function boot(): void
//
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.