SmsRuServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 19
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 7 1
A provides() 0 4 1
1
<?php
2
3
namespace NotificationChannels\SmsRu;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class SmsRuServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Register the application services.
11
     */
12
    public function register()
13
    {
14
        $this->app->singleton(SmsRuApi::class, function ($app) {
0 ignored issues
show
Unused Code introduced by
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 ignore-unused  annotation

14
        $this->app->singleton(SmsRuApi::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.

Loading history...
15
            $apiId = $this->app['config']['services.sms_ru.api_id'];
16
            $client = new SmsRuApi(new \Zelenin\SmsRu\Auth\ApiIdAuth($apiId));
0 ignored issues
show
Bug introduced by
The call to NotificationChannels\SmsRu\SmsRuApi::__construct() has too few arguments starting with client. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

16
            $client = /** @scrutinizer ignore-call */ new SmsRuApi(new \Zelenin\SmsRu\Auth\ApiIdAuth($apiId));

This check compares calls to functions or methods with their respective definitions. If the call has less 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.

Loading history...
17
18
            return $client;
19
        });
20
    }
21
22
    public function provides(): array
23
    {
24
        return [
25
            SmsRuApi::class,
26
        ];
27
    }
28
}
29