for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Iamolayemi\Paystack;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\ServiceProvider;
class PaystackServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*/
public function boot(): void
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/../config/config.php' => config_path('paystack.php'),
], 'config');
}
$this->validator();
* Register the application services.
public function register(): void
// Automatically apply the package configuration
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'paystack');
// Register the main class to use with the facade
$this->app->bind('paystack', function () {
//validate required credentials
$config = config('paystack');
Validator::make($config, [
'secret_key' => 'required|string',
])->validate();
return new Paystack(config('paystack.secret_key'));
});
private function validator()
Validator::macro('required_string', function ($attribute, $value, $arguments) {
$arguments
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
Validator::macro('required_string', function ($attribute, $value, /** @scrutinizer ignore-unused */ $arguments) {
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
return is_string($value) && !empty($value);
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.