| Conditions | 1 |
| Paths | 1 |
| Total Lines | 81 |
| Code Lines | 42 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 37 | public function register() |
||
| 38 | { |
||
| 39 | |||
| 40 | // implementation bindings: |
||
| 41 | //------------------------- |
||
| 42 | $this->app->bind( |
||
| 43 | 'Vinelab\Cdn\Contracts\CdnInterface', |
||
| 44 | 'Vinelab\Cdn\Cdn' |
||
| 45 | ); |
||
| 46 | |||
| 47 | $this->app->bind( |
||
| 48 | 'Vinelab\Cdn\Providers\Contracts\ProviderInterface', |
||
| 49 | 'Vinelab\Cdn\Providers\AwsS3Provider' |
||
| 50 | ); |
||
| 51 | |||
| 52 | $this->app->bind( |
||
| 53 | 'Vinelab\Cdn\Contracts\AssetInterface', |
||
| 54 | 'Vinelab\Cdn\Asset' |
||
| 55 | ); |
||
| 56 | |||
| 57 | $this->app->bind( |
||
| 58 | 'Vinelab\Cdn\Contracts\FinderInterface', |
||
| 59 | 'Vinelab\Cdn\Finder' |
||
| 60 | ); |
||
| 61 | |||
| 62 | $this->app->bind( |
||
| 63 | 'Vinelab\Cdn\Contracts\ProviderFactoryInterface', |
||
| 64 | 'Vinelab\Cdn\ProviderFactory' |
||
| 65 | ); |
||
| 66 | |||
| 67 | $this->app->bind( |
||
| 68 | 'Vinelab\Cdn\Contracts\CdnFacadeInterface', |
||
| 69 | 'Vinelab\Cdn\CdnFacade' |
||
| 70 | ); |
||
| 71 | |||
| 72 | $this->app->bind( |
||
| 73 | 'Vinelab\Cdn\Contracts\CdnHelperInterface', |
||
| 74 | 'Vinelab\Cdn\CdnHelper' |
||
| 75 | ); |
||
| 76 | |||
| 77 | $this->app->bind( |
||
| 78 | 'Vinelab\Cdn\Validators\Contracts\ProviderValidatorInterface', |
||
| 79 | 'Vinelab\Cdn\Validators\ProviderValidator' |
||
| 80 | ); |
||
| 81 | |||
| 82 | $this->app->bind( |
||
| 83 | 'Vinelab\Cdn\Validators\Contracts\CdnFacadeValidatorInterface', |
||
| 84 | 'Vinelab\Cdn\Validators\CdnFacadeValidator' |
||
| 85 | ); |
||
| 86 | |||
| 87 | $this->app->bind( |
||
| 88 | 'Vinelab\Cdn\Validators\Contracts\ValidatorInterface', |
||
| 89 | 'Vinelab\Cdn\Validators\Validator' |
||
| 90 | ); |
||
| 91 | |||
| 92 | // register the commands: |
||
| 93 | //----------------------- |
||
| 94 | $this->app->singleton('cdn.push', function ($app) { |
||
| 95 | return $app->make('Vinelab\Cdn\Commands\PushCommand'); |
||
| 96 | }); |
||
| 97 | $this->commands('cdn.push'); |
||
| 98 | |||
| 99 | $this->app->singleton('cdn.empty', function ($app) { |
||
| 100 | return $app->make('Vinelab\Cdn\Commands\EmptyCommand'); |
||
| 101 | }); |
||
| 102 | $this->commands('cdn.empty'); |
||
| 103 | |||
| 104 | // facade bindings: |
||
| 105 | //----------------- |
||
| 106 | |||
| 107 | // Register 'CdnFacade' instance container to our CdnFacade object |
||
| 108 | $this->app->singleton('cdn', function ($app) { |
||
| 109 | return $app->make('Vinelab\Cdn\CdnFacade'); |
||
| 110 | }); |
||
| 111 | |||
| 112 | // Shortcut so developers don't need to add an Alias in app/config/app.php |
||
| 113 | $this->app->booting(function () { |
||
| 114 | $loader = \Illuminate\Foundation\AliasLoader::getInstance(); |
||
| 115 | $loader->alias('Cdn', 'Vinelab\Cdn\Facades\CdnFacadeAccessor'); |
||
| 116 | }); |
||
| 117 | } |
||
| 118 | |||
| 129 |