These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Maknz\Slack; |
||
4 | |||
5 | use Illuminate\Support\ServiceProvider; |
||
6 | use RuntimeException; |
||
7 | |||
8 | class SlackServiceProvider extends ServiceProvider |
||
9 | { |
||
10 | /** |
||
11 | * Indicates if loading of the provider is deferred. |
||
12 | * |
||
13 | * @var bool |
||
14 | */ |
||
15 | protected $defer = false; |
||
16 | |||
17 | /** |
||
18 | * The actual provider. |
||
19 | * |
||
20 | * @var \Illuminate\Support\ServiceProvider |
||
21 | */ |
||
22 | protected $provider; |
||
23 | |||
24 | /** |
||
25 | * Instantiate the service provider. |
||
26 | * |
||
27 | * @param mixed $app |
||
28 | * @return void |
||
0 ignored issues
–
show
|
|||
29 | */ |
||
30 | public function __construct($app) |
||
31 | { |
||
32 | parent::__construct($app); |
||
33 | |||
34 | $this->provider = $this->getProvider(); |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * Bootstrap the application events. |
||
39 | * |
||
40 | * @return void |
||
41 | */ |
||
42 | public function boot() |
||
43 | { |
||
44 | return $this->provider->boot(); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Register the service provider. |
||
49 | * |
||
50 | * @return void |
||
51 | */ |
||
52 | public function register() |
||
53 | { |
||
54 | return $this->provider->register(); |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * Return the service provider for the particular Laravel version. |
||
59 | * |
||
60 | * @return mixed |
||
61 | */ |
||
62 | private function getProvider() |
||
63 | { |
||
64 | $app = $this->app; |
||
65 | |||
66 | $version = intval($app::VERSION); |
||
67 | |||
68 | switch ($version) { |
||
69 | case 4: |
||
70 | return new SlackServiceProviderLaravel4($app); |
||
71 | |||
72 | case 5: |
||
73 | return new SlackServiceProviderLaravel5($app); |
||
74 | |||
75 | default: |
||
76 | throw new RuntimeException('Your version of Laravel is not supported'); |
||
77 | } |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * Get the services provided by the provider. |
||
82 | * |
||
83 | * @return array |
||
84 | */ |
||
85 | public function provides() |
||
86 | { |
||
87 | return ['maknz.slack']; |
||
88 | } |
||
89 | } |
||
90 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.