1 | <?php namespace Arcanesoft\Auth\Providers; |
||
15 | class PackagesServiceProvider extends ServiceProvider |
||
16 | { |
||
17 | /* ------------------------------------------------------------------------------------------------ |
||
18 | | Main Functions |
||
19 | | ------------------------------------------------------------------------------------------------ |
||
20 | */ |
||
21 | /** |
||
22 | * Register the service provider. |
||
23 | */ |
||
24 | 12 | public function register() |
|
25 | { |
||
26 | 12 | $this->registerGravatarPackage(); |
|
27 | 12 | $this->registerLaravelAuthPackage(); |
|
28 | 12 | } |
|
29 | |||
30 | /* ------------------------------------------------------------------------------------------------ |
||
31 | | Register Packages |
||
32 | | ------------------------------------------------------------------------------------------------ |
||
33 | */ |
||
34 | /** |
||
35 | * Register the gravatar package. |
||
36 | */ |
||
37 | 12 | private function registerGravatarPackage() |
|
38 | { |
||
39 | 12 | $this->registerProvider(GravatarServiceProvider::class); |
|
40 | 12 | } |
|
41 | |||
42 | /** |
||
43 | * Register the laravel auth package. |
||
44 | */ |
||
45 | 12 | private function registerLaravelAuthPackage() |
|
46 | { |
||
47 | 12 | $this->registerProvider(LaravelAuthServiceProvider::class); |
|
48 | |||
49 | 12 | $this->configLaravelAuthPackage(); |
|
50 | 12 | $this->rebindModels(); |
|
51 | 12 | $this->registerDependencies(); |
|
|
|||
52 | 12 | } |
|
53 | |||
54 | /* ------------------------------------------------------------------------------------------------ |
||
55 | | Config Packages |
||
56 | | ------------------------------------------------------------------------------------------------ |
||
57 | */ |
||
58 | /** |
||
59 | * Config the laravel auth package (override). |
||
60 | */ |
||
61 | 12 | private function configLaravelAuthPackage() |
|
62 | { |
||
63 | /** @var \Illuminate\Contracts\Config\Repository $config */ |
||
64 | 12 | $config = $this->config(); |
|
65 | 12 | $config->set('laravel-auth', Arr::except($config->get('arcanesoft.auth'), ['route', 'hasher'])); |
|
66 | |||
67 | 12 | if (SocialAuthenticator::isEnabled()) { |
|
68 | $this->registerProvider(\Laravel\Socialite\SocialiteServiceProvider::class); |
||
69 | } |
||
70 | 12 | } |
|
71 | |||
72 | /** |
||
73 | * Rebind the auth models. |
||
74 | */ |
||
75 | 12 | private function rebindModels() |
|
98 | |||
99 | /** |
||
100 | * Register the package dependencies. |
||
101 | */ |
||
102 | 12 | private function registerDependencies() |
|
106 | } |
||
107 |
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()
method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail()
, this method _has_ side-effects. In the following case, we could not remove the method call: