| Total Lines | 56 |
| Code Lines | 27 |
| 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 |
||
| 21 | public function register(DiInterface $container) |
||
| 22 | { |
||
| 23 | $config = $container->get('config'); |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Setting up the view component. |
||
| 27 | */ |
||
| 28 | $container->set('view', function () use ($config, $container) { |
||
| 29 | $view = new SimpleView(); |
||
| 30 | $view->setViewsDir($config->filesystem->local->path . '/view/'); |
||
| 31 | $view->registerEngines([ |
||
| 32 | '.volt' => function ($view, $container) use ($config) { |
||
| 33 | $volt = new VoltEngine($view, $container); |
||
| 34 | $volt->setOptions([ |
||
| 35 | //CACHE save DISABLED IN DEV ENVIRONMENT |
||
| 36 | 'compiledPath' => appPath('storage/cache/volt/'), |
||
| 37 | 'compiledSeparator' => '_', |
||
| 38 | 'compileAlways' => !$config->app->production, |
||
| 39 | ]); |
||
| 40 | |||
| 41 | $volt->getCompiler()->addExtension(new class { |
||
| 42 | /** |
||
| 43 | * This method is called for any PHP function on the volt. |
||
| 44 | */ |
||
| 45 | public function compileFunction($name, $arguments) |
||
| 46 | { |
||
| 47 | if (function_exists($name)) { |
||
| 48 | return "{$name}({$arguments})"; |
||
| 49 | } |
||
| 50 | } |
||
| 51 | }); |
||
| 52 | |||
| 53 | return $volt; |
||
| 54 | }, |
||
| 55 | ]); |
||
| 56 | |||
| 57 | return $view; |
||
| 58 | }); |
||
| 59 | |||
| 60 | /** |
||
| 61 | * View cache. |
||
| 62 | */ |
||
| 63 | $container->set( |
||
| 64 | 'viewCache', |
||
| 65 | function () use ($config) { |
||
| 66 | if (!$config->app->production) { |
||
| 67 | $frontCache = new NoneCache(); |
||
| 68 | } else { |
||
| 69 | //Cache data for one day by default |
||
| 70 | $frontCache = new FrontenCacheOutput([ |
||
| 71 | 'lifetime' => 172800, |
||
| 72 | ]); |
||
| 73 | } |
||
| 74 | return new BackendFileCache($frontCache, [ |
||
| 75 | 'cacheDir' => appPath('storage/cache/volt/'), |
||
| 76 | 'prefix' => $config->app->id . '-', |
||
| 77 | ]); |
||
| 82 |
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