| Conditions | 1 |
| Paths | 1 |
| Total Lines | 91 |
| Code Lines | 46 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 63 | public function register() |
||
| 64 | { |
||
| 65 | $this->mergeConfigFrom( dirname( __DIR__ ) . '/config/default.php', 'shop' ); |
||
| 66 | |||
| 67 | $this->app->scoped( 'aimeos', function( $app ) { |
||
| 68 | return new \Aimeos\Shop\Base\Aimeos( $app['config'] ); |
||
| 69 | }); |
||
| 70 | |||
| 71 | $this->app->scoped( 'aimeos.config', function( $app ) { |
||
| 72 | return new \Aimeos\Shop\Base\Config( $app['config'], $app['aimeos'] ); |
||
| 73 | }); |
||
| 74 | |||
| 75 | $this->app->scoped( 'aimeos.i18n', function( $app ) { |
||
| 76 | return new \Aimeos\Shop\Base\I18n( $this->app['config'], $app['aimeos'] ); |
||
| 77 | }); |
||
| 78 | |||
| 79 | $this->app->scoped( 'aimeos.locale', function( $app ) { |
||
| 80 | return new \Aimeos\Shop\Base\Locale( $app['config'] ); |
||
| 81 | }); |
||
| 82 | |||
| 83 | $this->app->scoped( 'aimeos.context', function( $app ) { |
||
| 84 | return new \Aimeos\Shop\Base\Context( $app['session.store'], $app['aimeos.config'], $app['aimeos.locale'], $app['aimeos.i18n'] ); |
||
| 85 | }); |
||
| 86 | |||
| 87 | $this->app->scoped( 'aimeos.support', function( $app ) { |
||
| 88 | return new \Aimeos\Shop\Base\Support( $app['aimeos.context'], $app['aimeos.locale'] ); |
||
| 89 | }); |
||
| 90 | |||
| 91 | $this->app->scoped( 'aimeos.view', function( $app ) { |
||
| 92 | return new \Aimeos\Shop\Base\View( $app['config'], $app['aimeos.i18n'], $app['aimeos.support'] ); |
||
| 93 | }); |
||
| 94 | |||
| 95 | $this->app->scoped( 'aimeos.shop', function( $app ) { |
||
| 96 | return new \Aimeos\Shop\Base\Shop( $app['aimeos'], $app['aimeos.context'], $app['aimeos.view'] ); |
||
| 97 | }); |
||
| 98 | |||
| 99 | |||
| 100 | $this->app->bind( 'aimeos.frontend.attribute', function( $app ) { |
||
| 101 | return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'attribute' ); |
||
| 102 | }); |
||
| 103 | |||
| 104 | $this->app->bind( 'aimeos.frontend.basket', function( $app ) { |
||
| 105 | return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'basket' ); |
||
| 106 | }); |
||
| 107 | |||
| 108 | $this->app->bind( 'aimeos.frontend.catalog', function( $app ) { |
||
| 109 | return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'catalog' ); |
||
| 110 | }); |
||
| 111 | |||
| 112 | $this->app->bind( 'aimeos.frontend.cms', function( $app ) { |
||
| 113 | return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'cms' ); |
||
| 114 | }); |
||
| 115 | |||
| 116 | $this->app->bind( 'aimeos.frontend.customer', function( $app ) { |
||
| 117 | return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'customer' ); |
||
| 118 | }); |
||
| 119 | |||
| 120 | $this->app->bind( 'aimeos.frontend.locale', function( $app ) { |
||
| 121 | return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'locale' ); |
||
| 122 | }); |
||
| 123 | |||
| 124 | $this->app->bind( 'aimeos.frontend.order', function( $app ) { |
||
| 125 | return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'order' ); |
||
| 126 | }); |
||
| 127 | |||
| 128 | $this->app->bind( 'aimeos.frontend.product', function( $app ) { |
||
| 129 | return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'product' ); |
||
| 130 | }); |
||
| 131 | |||
| 132 | $this->app->bind( 'aimeos.frontend.service', function( $app ) { |
||
| 133 | return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'service' ); |
||
| 134 | }); |
||
| 135 | |||
| 136 | $this->app->bind( 'aimeos.frontend.stock', function( $app ) { |
||
| 137 | return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'stock' ); |
||
| 138 | }); |
||
| 139 | |||
| 140 | $this->app->bind( 'aimeos.frontend.subscription', function( $app ) { |
||
| 141 | return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'subscription' ); |
||
| 142 | }); |
||
| 143 | |||
| 144 | $this->app->bind( 'aimeos.frontend.supplier', function( $app ) { |
||
| 145 | return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'supplier' ); |
||
| 146 | }); |
||
| 147 | |||
| 148 | |||
| 149 | $this->commands( array( |
||
| 150 | 'Aimeos\Shop\Command\AccountCommand', |
||
| 151 | 'Aimeos\Shop\Command\ClearCommand', |
||
| 152 | 'Aimeos\Shop\Command\SetupCommand', |
||
| 153 | 'Aimeos\Shop\Command\JobsCommand', |
||
| 154 | ) ); |
||
| 174 | } |