Conditions | 11 |
Paths | 8 |
Total Lines | 34 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 7 | ||
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 |
||
36 | public function boot() |
||
37 | { |
||
38 | $ds = DIRECTORY_SEPARATOR; |
||
39 | $basedir = dirname( __DIR__, 2 ) . $ds; |
||
40 | |||
41 | $this->loadRoutesFrom( $basedir . 'routes.php' ); |
||
42 | $this->loadViewsFrom( $basedir . 'views', 'shop' ); |
||
43 | |||
44 | $this->publishes( [$basedir . 'config/shop.php' => config_path( 'shop.php' )], 'config' ); |
||
45 | $this->publishes( [dirname( $basedir ) . $ds . 'public' => public_path( 'vendor/shop' )], 'public' ); |
||
46 | |||
47 | if( file_exists( $basepath = base_path( 'ext' ) ) ) |
||
48 | { |
||
49 | foreach( new \DirectoryIterator( $basepath ) as $entry ) |
||
50 | { |
||
51 | if( $entry->isDir() && !$entry->isDot() && file_exists( $entry->getPathName() . '/client/html/themes' ) ) { |
||
52 | $this->publishes( [$entry->getPathName() . '/client/html/themes' => public_path( 'vendor/shop/themes' )], 'public' ); |
||
53 | } |
||
54 | } |
||
55 | } |
||
56 | |||
57 | $class = '\Composer\InstalledVersions'; |
||
58 | |||
59 | if( class_exists( $class ) && method_exists( $class, 'getInstalledPackagesByType' ) ) |
||
60 | { |
||
61 | $extdir = base_path( 'ext' ); |
||
62 | $packages = \Composer\InstalledVersions::getInstalledPackagesByType( 'aimeos-extension' ); |
||
63 | |||
64 | foreach( $packages as $package ) |
||
65 | { |
||
66 | $path = realpath( \Composer\InstalledVersions::getInstallPath( $package ) ); |
||
|
|||
67 | |||
68 | if( strncmp( $path, $extdir, strlen( $extdir ) ) && file_exists( $path . '/client/html/themes' ) ) { |
||
69 | $this->publishes( [$path . '/client/html/themes' => public_path( 'vendor/shop/themes' )], 'public' ); |
||
70 | } |
||
143 | } |