Hackathonners /
swap
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | namespace App\Providers; |
||||||
| 4 | |||||||
| 5 | use App\Judite\Models\Settings; |
||||||
| 6 | use Illuminate\Support\Facades\App; |
||||||
| 7 | use Illuminate\Support\Facades\URL; |
||||||
| 8 | use Illuminate\Support\Facades\Auth; |
||||||
| 9 | use Illuminate\Support\ServiceProvider; |
||||||
| 10 | use Illuminate\Support\Facades\Validator; |
||||||
| 11 | use App\Judite\Registry\EloquentExchangeRegistry; |
||||||
| 12 | use App\Judite\Contracts\Registry\ExchangeRegistry; |
||||||
| 13 | |||||||
| 14 | class AppServiceProvider extends ServiceProvider |
||||||
| 15 | { |
||||||
| 16 | /** |
||||||
| 17 | * Bootstrap any application services. |
||||||
| 18 | */ |
||||||
| 19 | public function boot() |
||||||
| 20 | { |
||||||
| 21 | if (App::environment('production')) { |
||||||
|
0 ignored issues
–
show
|
|||||||
| 22 | URL::forceScheme('https'); |
||||||
| 23 | } |
||||||
| 24 | |||||||
| 25 | Auth::macro('student', function () { |
||||||
| 26 | return Auth::check() ? Auth::user()->student : null; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 27 | }); |
||||||
| 28 | |||||||
| 29 | Validator::extend('student_number', function ($attribute, $value, $parameters, $validator) { |
||||||
|
0 ignored issues
–
show
The parameter
$validator is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
The parameter
$parameters is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||||
| 30 | return preg_match('/^(a|pg)[0-9]+$/i', $value) === 1; |
||||||
| 31 | }); |
||||||
| 32 | } |
||||||
| 33 | |||||||
| 34 | /** |
||||||
| 35 | * Register any application services. |
||||||
| 36 | */ |
||||||
| 37 | public function register() |
||||||
| 38 | { |
||||||
| 39 | $this->app->singleton(ExchangeRegistry::class, function ($app) { |
||||||
|
0 ignored issues
–
show
The parameter
$app is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||||
| 40 | return new EloquentExchangeRegistry(); |
||||||
| 41 | }); |
||||||
| 42 | |||||||
| 43 | $this->app->singleton('settings', function ($app) { |
||||||
|
0 ignored issues
–
show
The parameter
$app is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||||
| 44 | return Settings::firstOrNew([]); |
||||||
| 45 | }); |
||||||
| 46 | } |
||||||
| 47 | } |
||||||
| 48 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.