TDKServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 14 2
A register() 0 2 1
A provides() 0 4 1
1
<?php
2
3
namespace TheCaliskan\TDK;
4
5
use Illuminate\Http\Client\Response;
6
use Illuminate\Support\ServiceProvider;
7
8
class TDKServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Register any application services.
12
     *
13
     * @return void
14
     */
15
    public function register()
16
    {
17
    }
18
19
    /**
20
     * Bootstrap any application services.
21
     *
22
     * @return void
23
     */
24
    public function boot()
25
    {
26
        Response::macro('tdkThrow', function () {
27
            $this->throw();
0 ignored issues
show
Bug introduced by
The method throw() does not exist on TheCaliskan\TDK\TDKServiceProvider. ( Ignorable by Annotation )

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

27
            $this->/** @scrutinizer ignore-call */ 
28
                   throw();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
28
29
            if (isset($this->json()['error'])) {
0 ignored issues
show
Bug introduced by
The method json() does not exist on TheCaliskan\TDK\TDKServiceProvider. ( Ignorable by Annotation )

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

29
            if (isset($this->/** @scrutinizer ignore-call */ json()['error'])) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
30
                throw new TDKException($this);
0 ignored issues
show
Bug introduced by
$this of type TheCaliskan\TDK\TDKServiceProvider is incompatible with the type Illuminate\Http\Client\Response expected by parameter $response of TheCaliskan\TDK\TDKException::__construct(). ( Ignorable by Annotation )

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

30
                throw new TDKException(/** @scrutinizer ignore-type */ $this);
Loading history...
31
            }
32
33
            return $this;
34
        });
35
36
        $this->app->singleton('thecaliskan-tdk', function ($app) {
37
            return new TDK($app);
38
        });
39
    }
40
41
    /**
42
     * Get the services provided by the provider.
43
     *
44
     * @return array
45
     */
46
    public function provides()
47
    {
48
        return [
49
            'thecaliskan-tdk',
50
        ];
51
    }
52
}
53