ARCANEDEV /
Gravatar
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php namespace Arcanedev\Gravatar; |
||
| 2 | |||
| 3 | use Arcanedev\Support\PackageServiceProvider as ServiceProvider; |
||
| 4 | |||
| 5 | /** |
||
| 6 | * Class GravatarServiceProvider |
||
| 7 | * |
||
| 8 | * @package Arcanedev\Gravatar |
||
| 9 | * @author ARCANEDEV <[email protected]> |
||
| 10 | */ |
||
| 11 | class GravatarServiceProvider extends ServiceProvider |
||
| 12 | { |
||
| 13 | /* ------------------------------------------------------------------------------------------------ |
||
| 14 | | Properties |
||
| 15 | | ------------------------------------------------------------------------------------------------ |
||
| 16 | */ |
||
| 17 | /** |
||
| 18 | * Vendor name. |
||
| 19 | * |
||
| 20 | * @var string |
||
| 21 | */ |
||
| 22 | protected $vendor = 'arcanedev'; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Package name. |
||
| 26 | * |
||
| 27 | * @var string |
||
| 28 | */ |
||
| 29 | protected $package = 'gravatar'; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Indicates if loading of the provider is deferred. |
||
| 33 | * |
||
| 34 | * @var bool |
||
| 35 | */ |
||
| 36 | protected $defer = true; |
||
| 37 | |||
| 38 | /* ------------------------------------------------------------------------------------------------ |
||
| 39 | | Getters & Setters |
||
| 40 | | ------------------------------------------------------------------------------------------------ |
||
| 41 | */ |
||
| 42 | /** |
||
| 43 | * Get the base path of the package. |
||
| 44 | * |
||
| 45 | * @return string |
||
| 46 | */ |
||
| 47 | 228 | public function getBasePath() |
|
| 48 | { |
||
| 49 | 228 | return dirname(__DIR__); |
|
| 50 | } |
||
| 51 | |||
| 52 | /* ------------------------------------------------------------------------------------------------ |
||
| 53 | | Main Functions |
||
| 54 | | ------------------------------------------------------------------------------------------------ |
||
| 55 | */ |
||
| 56 | /** |
||
| 57 | * Register the service provider. |
||
| 58 | */ |
||
| 59 | 228 | public function register() |
|
| 60 | { |
||
| 61 | 228 | $this->registerConfig(); |
|
| 62 | 228 | $this->registerGravatar(); |
|
| 63 | 228 | } |
|
| 64 | |||
| 65 | /** |
||
| 66 | * Boot the service provider. |
||
| 67 | */ |
||
| 68 | 228 | public function boot() |
|
| 69 | { |
||
| 70 | 228 | $this->publishConfig(); |
|
|
0 ignored issues
–
show
|
|||
| 71 | 228 | } |
|
| 72 | |||
| 73 | /** |
||
| 74 | * Get the services provided by the provider. |
||
| 75 | * |
||
| 76 | * @return array |
||
| 77 | */ |
||
| 78 | 24 | public function provides() |
|
| 79 | { |
||
| 80 | return [ |
||
| 81 | 24 | 'arcanedev.gravatar', |
|
| 82 | 18 | Contracts\Gravatar::class, |
|
| 83 | 18 | ]; |
|
| 84 | } |
||
| 85 | |||
| 86 | /* ------------------------------------------------------------------------------------------------ |
||
| 87 | | Other Functions |
||
| 88 | | ------------------------------------------------------------------------------------------------ |
||
| 89 | */ |
||
| 90 | /** |
||
| 91 | * Register Gravatar Helper. |
||
| 92 | */ |
||
| 93 | private function registerGravatar() |
||
| 94 | { |
||
| 95 | 228 | $this->singleton('arcanedev.gravatar', function($app) { |
|
| 96 | /** @var \Illuminate\Config\Repository $config */ |
||
| 97 | 192 | $config = $app['config']; |
|
| 98 | |||
| 99 | 192 | return new Gravatar( |
|
| 100 | 192 | $config->get('gravatar.default', 'mm'), |
|
| 101 | 192 | $config->get('gravatar.size', 80), |
|
| 102 | 192 | $config->get('gravatar.max-rating', 'g') |
|
| 103 | 144 | ); |
|
| 104 | 228 | }); |
|
| 105 | |||
| 106 | 228 | $this->bind(Contracts\Gravatar::class, 'arcanedev.gravatar'); |
|
| 107 | 228 | } |
|
| 108 | } |
||
| 109 |
If you implement
__calland you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__callis implemented by a parent class and only the child class knows which methods exist: