Completed
Pull Request — master (#72)
by
unknown
06:35
created

CartServiceProvider::boot()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 0
1
<?php namespace Darryldecode\Cart;
2
3
use Illuminate\Support\ServiceProvider;
4
5
class CartServiceProvider extends ServiceProvider {
6
7
	/**
8
	 * Indicates if loading of the provider is deferred.
9
	 *
10
	 * @var bool
11
	 */
12
	protected $defer = false;
13
14
	/**
15
	 * Boot the service provider.
16
	 */
17
	public function boot()
18
	{
19
		if (function_exists('config_path')) {
20
			$this->publishes([
21
				__DIR__.'/config/config.php' => config_path('shopping_cart.php'),
22
			], 'config');
23
		}
24
	}
25
26
	/**
27
	 * Register the service provider.
28
	 *
29
	 * @return void
30
	 */
31
	public function register()
32
	{
33
		$this->mergeConfigFrom(__DIR__.'/config/config.php', 'shopping_cart');
34
35
		$this->app['cart'] = $this->app->share(function($app)
0 ignored issues
show
Bug introduced by
The method share() does not seem to exist on object<Illuminate\Contra...Foundation\Application>.

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...
36
		{
37
			$storage = $app['session'];
38
			$events = $app['events'];
39
			$instanceName = 'cart';
40
			$session_key = '4yTlTDKu3oJOfzD';
41
42
			return new Cart(
43
				$storage,
44
				$events,
45
				$instanceName,
46
				$session_key,
47
				config('geoip')
48
			);
49
		});
50
	}
51
52
	/**
53
	 * Get the services provided by the provider.
54
	 *
55
	 * @return array
56
	 */
57
	public function provides()
58
	{
59
		return array();
60
	}
61
}
62