1
|
|
|
<?php namespace WITR\Providers; |
2
|
|
|
|
3
|
|
|
use Illuminate\Support\ServiceProvider; |
4
|
|
|
use WITR\Services\Whitelist; |
5
|
|
|
use WITR\Services\IcecastReader; |
6
|
|
|
|
7
|
|
|
class AppServiceProvider extends ServiceProvider { |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Bootstrap any application services. |
11
|
|
|
* |
12
|
|
|
* @return void |
13
|
|
|
*/ |
14
|
|
|
public function boot() |
15
|
|
|
{ |
16
|
|
|
// |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Register any application services. |
21
|
|
|
* |
22
|
|
|
* This service provider is a great spot to register your various container |
23
|
|
|
* bindings with the application. As you can see, we are registering our |
24
|
|
|
* "Registrar" implementation here. You can add your own bindings too! |
25
|
|
|
* |
26
|
|
|
* @return void |
27
|
|
|
*/ |
28
|
|
|
public function register() |
29
|
|
|
{ |
30
|
|
|
$this->app->bind( |
31
|
|
|
'Illuminate\Contracts\Auth\Registrar', |
32
|
|
|
'WITR\Services\Registrar' |
33
|
|
|
); |
34
|
|
|
|
35
|
|
|
if ($this->app->environment('production')) { |
|
|
|
|
36
|
|
|
$this->app->bind('WITR\TopTwenty\Reader', 'WITR\TopTwenty\SQLReader'); |
37
|
|
|
} else { |
38
|
|
|
$this->app->bind('WITR\TopTwenty\Reader', 'WITR\TopTwenty\DummyReader'); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
if($this->app->environment('local')) |
|
|
|
|
42
|
|
|
{ |
43
|
|
|
$this->app->register('Barryvdh\Debugbar\ServiceProvider'); |
44
|
|
|
$this->app->register('Laracasts\Generators\GeneratorsServiceProvider'); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
$this->app->singleton('WITR\ViewComposers\DJsViewComposer'); |
48
|
|
|
$this->app->singleton('WITR\ViewComposers\ShowsViewComposer'); |
49
|
|
|
|
50
|
|
|
$this->app['view']->composers([ |
51
|
|
|
'WITR\ViewComposers\DJsViewComposer' => 'shared.dj_dropdown', |
52
|
|
|
'WITR\ViewComposers\ShowsViewComposer' => 'shared.show_dropdown', |
53
|
|
|
'WITR\ViewComposers\VideoViewComposer' => 'home.partials.video', |
54
|
|
|
'WITR\ViewComposers\AlbumsViewComposer' => 'home.partials.albums', |
55
|
|
|
'WITR\ViewComposers\SliderViewComposer' => 'home.partials.slider', |
56
|
|
|
'WITR\ViewComposers\NowPlayingViewComposer' => 'home.partials.nowplaying', |
57
|
|
|
'WITR\ViewComposers\TopTwentyViewComposer' => 'home.partials.toptwenty', |
58
|
|
|
'WITR\ViewComposers\AuthViewComposer' => 'layouts.partials.auth-buttons', |
59
|
|
|
]); |
60
|
|
|
|
61
|
|
|
$this->app->bind('WITR\Services\Whitelist', function($app) { |
62
|
|
|
$config = $app['config']; |
63
|
|
|
$startIp = $config['witr.whitelist.start']; |
64
|
|
|
$endIp = $config['witr.whitelist.end']; |
65
|
|
|
return new Whitelist($startIp, $endIp); |
66
|
|
|
}); |
67
|
|
|
|
68
|
|
|
$this->app->bind('WITR\Services\IcecastReader', function($app) { |
69
|
|
|
$config = $app['config']; |
70
|
|
|
$hostname = $config['witr.icecast.hostname']; |
71
|
|
|
$credentials = $config['witr.icecast.credentials']; |
72
|
|
|
$mounts = $config['witr.icecast.mounts']; |
73
|
|
|
return new IcecastReader($hostname, $credentials, $mounts); |
74
|
|
|
}); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
} |
78
|
|
|
|
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.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.