| Conditions | 13 | 
| Paths | 384 | 
| Total Lines | 81 | 
| 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  | 
            ||
| 108 | public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)  | 
            ||
| 109 |     { | 
            ||
| 110 |         list($_attr, $_nocache, $_buffer, $_has_nocache_code, $_caching) = $this->closeTag($compiler, array('block')); | 
            ||
| 111 | // init block parameter  | 
            ||
| 112 | $_block = $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ];  | 
            ||
| 113 | unset($compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ]);  | 
            ||
| 114 | $_name = $_attr[ 'name' ];  | 
            ||
| 115 | $_assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : null;  | 
            ||
| 116 | unset($_attr[ 'assign' ], $_attr[ 'name' ]);  | 
            ||
| 117 |         foreach ($_attr as $name => $stat) { | 
            ||
| 118 |             if ((is_bool($stat) && $stat !== false) || (!is_bool($stat) && $stat !== 'false')) { | 
            ||
| 119 | $_block[ $name ] = 'true';  | 
            ||
| 120 | }  | 
            ||
| 121 | }  | 
            ||
| 122 | $_className = $compiler->_cache[ 'blockClass' ][ $compiler->_cache[ 'blockNesting' ] ];  | 
            ||
| 123 | // get compiled block code  | 
            ||
| 124 | $_functionCode = $compiler->parser->current_buffer;  | 
            ||
| 125 | // setup buffer for template function code  | 
            ||
| 126 | $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();  | 
            ||
| 127 | $output = "<?php\n";  | 
            ||
| 128 |         $output .= "/* {block {$_name}} */\n"; | 
            ||
| 129 |         $output .= "class {$_className} extends Smarty_Internal_Block\n"; | 
            ||
| 130 |         $output .= "{\n"; | 
            ||
| 131 |         foreach ($_block as $property => $value) { | 
            ||
| 132 |             $output .= "public \${$property} = " . var_export($value, true) . ";\n"; | 
            ||
| 133 | }  | 
            ||
| 134 |         $output .= "public function callBlock(Smarty_Internal_Template \$_smarty_tpl) {\n"; | 
            ||
| 135 | $output .= $compiler->compileRequiredPlugins();  | 
            ||
| 136 | $compiler->restoreRequiredPlugins();  | 
            ||
| 137 |         if ($compiler->template->compiled->has_nocache_code) { | 
            ||
| 138 |             $output .= "\$_smarty_tpl->cached->hashes['{$compiler->template->compiled->nocache_hash}'] = true;\n"; | 
            ||
| 139 | }  | 
            ||
| 140 |         if (isset($_assign)) { | 
            ||
| 141 | $output .= "ob_start();\n";  | 
            ||
| 142 | }  | 
            ||
| 143 | $output .= "?>\n";  | 
            ||
| 144 | $compiler->parser->current_buffer->append_subtree(  | 
            ||
| 145 | $compiler->parser,  | 
            ||
| 146 | new Smarty_Internal_ParseTree_Tag(  | 
            ||
| 147 | $compiler->parser,  | 
            ||
| 148 | $output  | 
            ||
| 149 | )  | 
            ||
| 150 | );  | 
            ||
| 151 | $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode);  | 
            ||
| 152 | $output = "<?php\n";  | 
            ||
| 153 |         if (isset($_assign)) { | 
            ||
| 154 |             $output .= "\$_smarty_tpl->assign({$_assign}, ob_get_clean());\n"; | 
            ||
| 155 | }  | 
            ||
| 156 | $output .= "}\n";  | 
            ||
| 157 | $output .= "}\n";  | 
            ||
| 158 |         $output .= "/* {/block {$_name}} */\n\n"; | 
            ||
| 159 | $output .= "?>\n";  | 
            ||
| 160 | $compiler->parser->current_buffer->append_subtree(  | 
            ||
| 161 | $compiler->parser,  | 
            ||
| 162 | new Smarty_Internal_ParseTree_Tag(  | 
            ||
| 163 | $compiler->parser,  | 
            ||
| 164 | $output  | 
            ||
| 165 | )  | 
            ||
| 166 | );  | 
            ||
| 167 | $compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser);  | 
            ||
| 168 | $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template();  | 
            ||
| 169 | // restore old status  | 
            ||
| 170 | $compiler->template->compiled->has_nocache_code = $_has_nocache_code;  | 
            ||
| 171 | $compiler->tag_nocache = $compiler->nocache;  | 
            ||
| 172 | $compiler->nocache = $_nocache;  | 
            ||
| 173 | $compiler->parser->current_buffer = $_buffer;  | 
            ||
| 174 | $output = "<?php \n";  | 
            ||
| 175 |         if ($compiler->_cache[ 'blockNesting' ] === 1) { | 
            ||
| 176 | $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name);\n";  | 
            ||
| 177 |         } else { | 
            ||
| 178 | $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name, \$this->tplIndex);\n";  | 
            ||
| 179 | }  | 
            ||
| 180 | $output .= "?>\n";  | 
            ||
| 181 | --$compiler->_cache[ 'blockNesting' ];  | 
            ||
| 182 |         if ($compiler->_cache[ 'blockNesting' ] === 0) { | 
            ||
| 183 | unset($compiler->_cache[ 'blockNesting' ]);  | 
            ||
| 184 | }  | 
            ||
| 185 | $compiler->has_code = true;  | 
            ||
| 186 | $compiler->suppressNocacheProcessing = true;  | 
            ||
| 187 | return $output;  | 
            ||
| 188 | }  | 
            ||
| 189 | }  | 
            ||
| 190 | 
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.