| Conditions | 2 | 
| Paths | 1 | 
| Total Lines | 57 | 
| Code Lines | 41 | 
| 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  | 
            ||
| 10 |     public function __construct($config = []) { | 
            ||
| 11 | $this->container = new Util\Container();  | 
            ||
| 12 | |||
| 13 |         $this->container->add('engine_methods', []); | 
            ||
| 14 |         $this->container->add('config', array_merge([ | 
            ||
| 15 | 'render_context_var_name' => 'v',  | 
            ||
| 16 | 'ext' => 'phtml',  | 
            ||
| 17 | 'base_dir' => null,  | 
            ||
| 18 | 'escape_encoding' => null,  | 
            ||
| 19 | 'escape_flags' => null,  | 
            ||
| 20 | 'validate_paths' => true,  | 
            ||
| 21 | 'php_extensions' => ['php', 'phtml'],  | 
            ||
| 22 | 'image_extensions' => ['png', 'jpg'],  | 
            ||
| 23 | ], $config));  | 
            ||
| 24 |         $this->container->add('compose', function($c) { | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 25 | return Util\id();  | 
            ||
| 26 | });  | 
            ||
| 27 |         $this->container->add('fileExists', function($c) { | 
            ||
| 28 | return 'file_exists';  | 
            ||
| 29 | });  | 
            ||
| 30 |         $this->container->add('renderTemplate', function($c) { | 
            ||
| 31 | $rt = new RenderTemplate\FileSystemRenderTemplate([  | 
            ||
| 32 | [  | 
            ||
| 33 |                     Template\matchExtensions($c->get('config')['php_extensions']), | 
            ||
| 34 |                     new RenderTemplate\PhpRenderTemplate($c->get('renderTemplate.bind')) | 
            ||
| 35 | ],  | 
            ||
| 36 | [  | 
            ||
| 37 |                     Template\matchExtensions($c->get('config')['image_extensions']), | 
            ||
| 38 | RenderTemplate\MapContentRenderTemplate::base64Encode(new RenderTemplate\StaticFileRenderTemplate())  | 
            ||
| 39 | ],  | 
            ||
| 40 | [  | 
            ||
| 41 | Template\matchStub(true),  | 
            ||
| 42 | new RenderTemplate\StaticFileRenderTemplate(),  | 
            ||
| 43 | ]  | 
            ||
| 44 | ]);  | 
            ||
| 45 |             if ($c->get('config')['validate_paths']) { | 
            ||
| 46 |                 $rt = new RenderTemplate\ValidatePathRenderTemplate($rt, $c->get('fileExists')); | 
            ||
| 47 | }  | 
            ||
| 48 | // $rt = new RenderTemplate\LayoutRenderTemplate($rt);  | 
            ||
| 49 |             $rt = array_reduce($c->get('renderTemplate.factories'), function($rt, $create) { | 
            ||
| 50 | return $create($rt);  | 
            ||
| 51 | }, $rt);  | 
            ||
| 52 |             $rt = new RenderTemplate\ComposeRenderTemplate($rt, $c->get('compose')); | 
            ||
| 53 | return $rt;  | 
            ||
| 54 | });  | 
            ||
| 55 |         $this->container->add('renderTemplate.bind', function() { | 
            ||
| 56 | return Util\id();  | 
            ||
| 57 | });  | 
            ||
| 58 |         $this->container->add('renderTemplate.factories', function() { | 
            ||
| 59 | return [];  | 
            ||
| 60 | });  | 
            ||
| 61 | $this->register(new Extension\Data\DataExtension());  | 
            ||
| 62 | $this->register(new Extension\Path\PathExtension());  | 
            ||
| 63 | $this->register(new Extension\RenderContext\RenderContextExtension());  | 
            ||
| 64 | $this->register(new Extension\LayoutSections\LayoutSectionsExtension());  | 
            ||
| 65 | $this->register(new Extension\Folders\FoldersExtension());  | 
            ||
| 66 | }  | 
            ||
| 67 | |||
| 100 | 
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.