| Conditions | 1 |
| Paths | 1 |
| Total Lines | 53 |
| Code Lines | 29 |
| 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 |
||
| 94 | private static function createContext( $site ) |
||
| 95 | { |
||
| 96 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
||
| 97 | $aimeos = self::getAimeos(); |
||
| 98 | |||
| 99 | |||
| 100 | $paths = $aimeos->getConfigPaths(); |
||
| 101 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
||
| 102 | $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser'; |
||
| 103 | $local = array( 'resource' => array( 'fs' => array( 'adapter' => 'Standard', 'basedir' => __DIR__ . '/tmp' ) ) ); |
||
| 104 | |||
| 105 | $conf = new \Aimeos\MW\Config\PHPArray( $local, $paths ); |
||
| 106 | $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
||
| 107 | $conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file ); |
||
| 108 | $ctx->setConfig( $conf ); |
||
| 109 | |||
| 110 | |||
| 111 | $logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG ); |
||
| 112 | $ctx->setLogger( $logger ); |
||
| 113 | |||
| 114 | |||
| 115 | $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
||
| 116 | $ctx->setDatabaseManager( $dbm ); |
||
| 117 | |||
| 118 | |||
| 119 | $fs = new \Aimeos\MW\Filesystem\Manager\Standard( $conf ); |
||
| 120 | $ctx->setFilesystemManager( $fs ); |
||
| 121 | |||
| 122 | |||
| 123 | $mq = new \Aimeos\MW\MQueue\Manager\Standard( $conf ); |
||
| 124 | $ctx->setMessageQueueManager( $mq ); |
||
| 125 | |||
| 126 | |||
| 127 | $cache = new \Aimeos\MW\Cache\None(); |
||
| 128 | $ctx->setCache( $cache ); |
||
| 129 | |||
| 130 | |||
| 131 | $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
||
| 132 | $ctx->setI18n( array( 'de' => $i18n ) ); |
||
| 133 | |||
| 134 | |||
| 135 | $session = new \Aimeos\MW\Session\None(); |
||
| 136 | $ctx->setSession( $session ); |
||
| 137 | |||
| 138 | |||
| 139 | $localeManager = \Aimeos\MShop\Locale\Manager\Factory::create( $ctx ); |
||
| 140 | $locale = $localeManager->bootstrap( $site, '', '', false ); |
||
| 141 | $ctx->setLocale( $locale ); |
||
| 142 | |||
| 143 | |||
| 144 | $ctx->setEditor( 'core:client/html' ); |
||
| 145 | |||
| 146 | return $ctx; |
||
| 147 | } |
||
| 149 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths