| Conditions | 10 |
| Paths | 11 |
| Total Lines | 35 |
| Code Lines | 22 |
| 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 |
||
| 19 | class actionRecorderAdmin extends actionRecorder { |
||
| 20 | function __construct($module, $user_id = null, $user_name = null) { |
||
| 21 | global $PHP_SELF; |
||
| 22 | |||
| 23 | $this->lang = Registry::get('Language'); |
||
| 24 | |||
| 25 | $module = HTML::sanitize(str_replace(' ', '', $module)); |
||
| 26 | |||
| 27 | if (defined('MODULE_ACTION_RECORDER_INSTALLED') && tep_not_null(MODULE_ACTION_RECORDER_INSTALLED)) { |
||
| 28 | if (tep_not_null($module) && in_array($module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), explode(';', MODULE_ACTION_RECORDER_INSTALLED))) { |
||
| 29 | if (!class_exists($module)) { |
||
| 30 | if (is_file(OSCOM::getConfig('dir_root', 'Shop') . 'includes/modules/action_recorder/' . $module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)))) { |
||
| 31 | $this->lang->loadDefinitions('Shop/modules/action_recorder/' . $module); |
||
| 32 | include(OSCOM::getConfig('dir_root', 'Shop') . 'includes/modules/action_recorder/' . $module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1))); |
||
| 33 | } else { |
||
| 34 | return false; |
||
|
|
|||
| 35 | } |
||
| 36 | } |
||
| 37 | } else { |
||
| 38 | return false; |
||
| 39 | } |
||
| 40 | } else { |
||
| 41 | return false; |
||
| 42 | } |
||
| 43 | |||
| 44 | $this->_module = $module; |
||
| 45 | |||
| 46 | if (!empty($user_id) && is_numeric($user_id)) { |
||
| 47 | $this->_user_id = $user_id; |
||
| 48 | } |
||
| 49 | |||
| 50 | if (!empty($user_name)) { |
||
| 51 | $this->_user_name = $user_name; |
||
| 52 | } |
||
| 53 | |||
| 54 | $GLOBALS[$this->_module] = new $module(); |
||
| 59 |