Passed
Push — 0.1-dev ( 2d539f...0d1b7d )
by Petr
07:22 queued 05:05
created

YourMembershipServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace P2A\YourMembership;
3
4
use Illuminate\Support\ServiceProvider;
5
use P2A\YourMembership\YourMembershipClient;
6
7
class YourMembershipServiceProvider extends ServiceProvider
8
{
9
10
	private $packageName = 'yourmembership';
11
	private $packageConfigPath = __DIR__.'/config/yourmembership.php';
12
	/**
13
	 * Indicates if loading of the provider is deferred.
14
	 *
15
	 * @var bool
16
	 */
17
	protected $defer = true;
18
19
	/**
20
	 * Register the service provider.
21
	 *
22
	 * @return void
23
	 */
24
	public function register()
25
	{
26
		$this->mergeConfigFrom(
27
	    	$this->packageConfigPath, $this->packageName
28
		);
29
30
		$this->app->register(YourMembershipClient::class, function($app, $parameters) {
1 ignored issue
show
Documentation introduced by
function ($app, $paramet...[0], $parameters[1]); } is of type object<Closure>, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
31
			$guzzleClient = new \GuzzleHttp\Client($app['config']['yourmembership']['guzzle-client']);
32
			return new YourMembershipClient($guzzleClient, $parameters[0], $parameters[1]);
33
		});
34
	}
35
36
	public function boot()
37
	{
38
		$this->publishes([
39
		$this->packageConfigPath => config_path('yourmembership.php'),
40
		]);
41
	}
42
43
	/**
44
	 * Get the services provided by the provider.
45
	 *
46
	 * @return array
47
	 */
48
	public function provides()
49
	{
50
		return array(YourMembershipClient::class);
51
	}
52
53
}
54