| Conditions | 1 |
| Paths | 1 |
| Total Lines | 83 |
| Code Lines | 39 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
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 |
||
| 41 | public function register() |
||
| 42 | { |
||
| 43 | |||
| 44 | // implementation bindings: |
||
| 45 | //------------------------- |
||
| 46 | $this->app->bind( |
||
| 47 | 'Rehmatworks\laravelcdn\Contracts\CdnInterface', |
||
| 48 | 'Rehmatworks\laravelcdn\Cdn' |
||
| 49 | ); |
||
| 50 | |||
| 51 | $this->app->bind( |
||
| 52 | 'Rehmatworks\laravelcdn\Providers\Contracts\ProviderInterface', |
||
| 53 | 'Rehmatworks\laravelcdn\Providers\AwsS3Provider' |
||
| 54 | ); |
||
| 55 | |||
| 56 | $this->app->bind( |
||
| 57 | 'Rehmatworks\laravelcdn\Contracts\AssetInterface', |
||
| 58 | 'Rehmatworks\laravelcdn\Asset' |
||
| 59 | ); |
||
| 60 | |||
| 61 | $this->app->bind( |
||
| 62 | 'Rehmatworks\laravelcdn\Contracts\FinderInterface', |
||
| 63 | 'Rehmatworks\laravelcdn\Finder' |
||
| 64 | ); |
||
| 65 | |||
| 66 | $this->app->bind( |
||
| 67 | 'Rehmatworks\laravelcdn\Contracts\ProviderFactoryInterface', |
||
| 68 | 'Rehmatworks\laravelcdn\ProviderFactory' |
||
| 69 | ); |
||
| 70 | |||
| 71 | $this->app->bind( |
||
| 72 | 'Rehmatworks\laravelcdn\Contracts\CdnFacadeInterface', |
||
| 73 | 'Rehmatworks\laravelcdn\CdnFacade' |
||
| 74 | ); |
||
| 75 | |||
| 76 | $this->app->bind( |
||
| 77 | 'Rehmatworks\laravelcdn\Contracts\CdnHelperInterface', |
||
| 78 | 'Rehmatworks\laravelcdn\CdnHelper' |
||
| 79 | ); |
||
| 80 | |||
| 81 | $this->app->bind( |
||
| 82 | 'Rehmatworks\laravelcdn\Validators\Contracts\ProviderValidatorInterface', |
||
| 83 | 'Rehmatworks\laravelcdn\Validators\ProviderValidator' |
||
| 84 | ); |
||
| 85 | |||
| 86 | $this->app->bind( |
||
| 87 | 'Rehmatworks\laravelcdn\Validators\Contracts\CdnFacadeValidatorInterface', |
||
| 88 | 'Rehmatworks\laravelcdn\Validators\CdnFacadeValidator' |
||
| 89 | ); |
||
| 90 | |||
| 91 | $this->app->bind( |
||
| 92 | 'Rehmatworks\laravelcdn\Validators\Contracts\ValidatorInterface', |
||
| 93 | 'Rehmatworks\laravelcdn\Validators\Validator' |
||
| 94 | ); |
||
| 95 | |||
| 96 | // register the commands: |
||
| 97 | //----------------------- |
||
| 98 | $this->app->singleton('cdn.push', function ($app) { |
||
| 99 | return $app->make('Rehmatworks\laravelcdn\Commands\PushCommand'); |
||
| 100 | }); |
||
| 101 | |||
| 102 | $this->commands('cdn.push'); |
||
| 103 | |||
| 104 | $this->app->singleton('cdn.empty', function ($app) { |
||
| 105 | return $app->make('Rehmatworks\laravelcdn\Commands\EmptyCommand'); |
||
| 106 | }); |
||
| 107 | |||
| 108 | $this->commands('cdn.empty'); |
||
| 109 | |||
| 110 | // facade bindings: |
||
| 111 | //----------------- |
||
| 112 | |||
| 113 | // Register 'CdnFacade' instance container to our CdnFacade object |
||
| 114 | $this->app->singleton('CDN', function ($app) { |
||
| 115 | return $app->make('Rehmatworks\laravelcdn\CdnFacade'); |
||
| 116 | }); |
||
| 117 | |||
| 118 | // Shortcut so developers don't need to add an Alias in app/config/app.php |
||
| 119 | // $this->app->booting(function () { |
||
| 120 | // $loader = \Illuminate\Foundation\AliasLoader::getInstance(); |
||
| 121 | // $loader->alias('Cdn', 'Rehmatworks\laravelcdn\Facades\CdnFacadeAccessor'); |
||
| 122 | // }); |
||
| 123 | } |
||
| 124 | |||
| 135 |