1 | <?php |
||||
2 | |||||
3 | namespace Mckenziearts\LaravelOAuth; |
||||
4 | |||||
5 | use Illuminate\Support\ServiceProvider; |
||||
6 | use Mckenziearts\LaravelOAuth\Providers\GitlabProvider; |
||||
7 | use Mckenziearts\LaravelOAuth\Providers\YoutubeProvider; |
||||
8 | use Mckenziearts\LaravelOAuth\Providers\DribbbleProvider; |
||||
9 | use Mckenziearts\LaravelOAuth\Providers\InstagramProvider; |
||||
10 | use Mckenziearts\LaravelOAuth\Providers\PinterestProvider; |
||||
11 | |||||
12 | class LaravelOAuthServiceProvider extends ServiceProvider |
||||
13 | { |
||||
14 | /** |
||||
15 | * Perform post-registration booting of services. |
||||
16 | * |
||||
17 | * @return void |
||||
18 | */ |
||||
19 | public function boot() |
||||
20 | { |
||||
21 | $this->loadTranslationsFrom(__DIR__.'/Lang', 'laravel-oauth'); |
||||
22 | |||||
23 | $this->publishes([ |
||||
24 | __DIR__.'/../public/assets' => public_path('vendor/mckenziearts/laravel-oauth/assets'), |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
25 | ], 'laravel-oauth.assets'); |
||||
26 | $this->publishes([ |
||||
27 | __DIR__.'/../migrations/' => database_path('migrations'), |
||||
0 ignored issues
–
show
The function
database_path was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
28 | ], 'laravel-oauth.migrations'); |
||||
29 | $this->publishes([ |
||||
30 | __DIR__.'/../config/laravel-oauth.php' => config_path('laravel-oauth.php'), |
||||
0 ignored issues
–
show
The function
config_path was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
31 | ], 'laravel-oauth.config'); |
||||
32 | $this->publishes([ |
||||
33 | __DIR__.'/Lang' => resource_path('lang/vendor/mckenziearts'), |
||||
0 ignored issues
–
show
The function
resource_path was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
34 | ], 'laravel-oauth.views'); |
||||
35 | |||||
36 | // Boot all new OAuth 2 Provider added to Socialite |
||||
37 | $this->bootInstagramSocialite(); |
||||
38 | $this->bootDribbbleSocialite(); |
||||
39 | $this->bootPinterestSocialite(); |
||||
40 | $this->bootYoutubeSocialite(); |
||||
41 | $this->bootGitlabSocialite(); |
||||
42 | } |
||||
43 | |||||
44 | /** |
||||
45 | * Register any package services. |
||||
46 | * |
||||
47 | * @return void |
||||
48 | */ |
||||
49 | public function register() |
||||
50 | { |
||||
51 | $this->mergeConfigFrom(__DIR__.'/../config/laravel-oauth.php', 'laravel-oauth'); |
||||
52 | |||||
53 | /* |
||||
54 | * Register the Laravel/socialite service provider |
||||
55 | */ |
||||
56 | $this->app->register(\Laravel\Socialite\SocialiteServiceProvider::class); |
||||
57 | |||||
58 | // Register custom blade directive |
||||
59 | $this->app->register(\Mckenziearts\LaravelOAuth\Providers\BladeServiceProvider::class); |
||||
60 | |||||
61 | /* |
||||
62 | * Create aliases for the dependency. |
||||
63 | */ |
||||
64 | $loader = \Illuminate\Foundation\AliasLoader::getInstance(); |
||||
0 ignored issues
–
show
The type
Illuminate\Foundation\AliasLoader was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
65 | $loader->alias('Socialite', \Laravel\Socialite\Facades\Socialite::class); |
||||
66 | |||||
67 | // Register the service the package provides. |
||||
68 | $this->app->singleton('laravelsocialite', function ($app) { |
||||
0 ignored issues
–
show
The parameter
$app is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||
69 | return new LaravelSocialite; |
||||
70 | }); |
||||
71 | // Create aliase for the package provider |
||||
72 | $loader->alias('LaravelSocialite', \Mckenziearts\LaravelOAuth\Facades\LaravelSocialite::class); |
||||
73 | } |
||||
74 | |||||
75 | /** |
||||
76 | * Get the services provided by the provider. |
||||
77 | * |
||||
78 | * @return array |
||||
79 | */ |
||||
80 | public function provides() |
||||
81 | { |
||||
82 | return ['laravelsocialite']; |
||||
83 | } |
||||
84 | |||||
85 | private function bootInstagramSocialite() |
||||
86 | { |
||||
87 | $socialite = $this->app->make(\Laravel\Socialite\Contracts\Factory::class); |
||||
88 | $socialite->extend( |
||||
89 | 'instagram', |
||||
90 | function ($app) use ($socialite) { |
||||
91 | $config = $app['config']['services.instagram']; |
||||
92 | |||||
93 | return $socialite->buildProvider(InstagramProvider::class, $config); |
||||
94 | } |
||||
95 | ); |
||||
96 | } |
||||
97 | |||||
98 | private function bootDribbbleSocialite() |
||||
99 | { |
||||
100 | $socialite = $this->app->make(\Laravel\Socialite\Contracts\Factory::class); |
||||
101 | $socialite->extend( |
||||
102 | 'dribbble', |
||||
103 | function ($app) use ($socialite) { |
||||
104 | $config = $app['config']['services.dribbble']; |
||||
105 | |||||
106 | return $socialite->buildProvider(DribbbleProvider::class, $config); |
||||
107 | } |
||||
108 | ); |
||||
109 | } |
||||
110 | |||||
111 | private function bootPinterestSocialite() |
||||
112 | { |
||||
113 | $socialite = $this->app->make(\Laravel\Socialite\Contracts\Factory::class); |
||||
114 | $socialite->extend( |
||||
115 | 'pinterest', |
||||
116 | function ($app) use ($socialite) { |
||||
117 | $config = $app['config']['services.pinterest']; |
||||
118 | |||||
119 | return $socialite->buildProvider(PinterestProvider::class, $config); |
||||
120 | } |
||||
121 | ); |
||||
122 | } |
||||
123 | |||||
124 | private function bootYoutubeSocialite() |
||||
125 | { |
||||
126 | $socialite = $this->app->make(\Laravel\Socialite\Contracts\Factory::class); |
||||
127 | $socialite->extend( |
||||
128 | 'youtube', |
||||
129 | function ($app) use ($socialite) { |
||||
130 | $config = $app['config']['services.youtube']; |
||||
131 | |||||
132 | return $socialite->buildProvider(YoutubeProvider::class, $config); |
||||
133 | } |
||||
134 | ); |
||||
135 | } |
||||
136 | |||||
137 | private function bootGitlabSocialite() |
||||
138 | { |
||||
139 | $socialite = $this->app->make(\Laravel\Socialite\Contracts\Factory::class); |
||||
140 | $socialite->extend( |
||||
141 | 'gitlab', |
||||
142 | function ($app) use ($socialite) { |
||||
143 | $config = $app['config']['services.gitlab']; |
||||
144 | |||||
145 | return $socialite->buildProvider(GitlabProvider::class, $config); |
||||
146 | } |
||||
147 | ); |
||||
148 | } |
||||
149 | } |
||||
150 |