| Conditions | 10 | 
| Paths | 27 | 
| Total Lines | 47 | 
| 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  | 
            ||
| 107 |     public function humanizedChanges($from, $to) { | 
            ||
| 108 |         if(!$from) { | 
            ||
| 109 |             return _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.UPLOADEDFILE', "Uploaded file"); | 
            ||
| 110 | }  | 
            ||
| 111 | |||
| 112 | $fromRecord = Versioned::get_version($this->owner->class, $this->owner->ID, $from);  | 
            ||
| 113 | $toRecord = Versioned::get_version($this->owner->class, $this->owner->ID, $to);  | 
            ||
| 114 | |||
| 115 | $diff = new DataDifferencer($fromRecord, $toRecord);  | 
            ||
| 116 | $changes = $diff->changedFieldNames();  | 
            ||
| 117 | |||
| 118 |         $k = array_search('LastEdited', $changes); | 
            ||
| 119 | |||
| 120 |         if($k !== false) { | 
            ||
| 121 | unset($changes[$k]);  | 
            ||
| 122 | }  | 
            ||
| 123 | |||
| 124 | $output = array();  | 
            ||
| 125 | |||
| 126 |         foreach($changes as $change) { | 
            ||
| 127 | $human = $change;  | 
            ||
| 128 | |||
| 129 |             if($change == "ParentID") { | 
            ||
| 130 | // updated folder ID  | 
            ||
| 131 |                 $human = _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdminFile.MOVEDFOLDER', "Moved file"); | 
            ||
| 132 |             } else if($change == 'Title') { | 
            ||
| 133 |                 $human = _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdminFile.RENAMEDTITLE', "Updated title to ") . $fromRecord->Title; | 
            ||
| 134 |             } else if($change == 'Name') { | 
            ||
| 135 |                 $human = _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdminFile.RENAMEDFILE', "Renamed file to ") . $fromRecord->Filename; | 
            ||
| 136 |             } else if($change == 'File') { | 
            ||
| 137 | // check to make sure the files are actually different  | 
            ||
| 138 |                 if($fromRecord->getHash() != $toRecord->getHash()) { | 
            ||
| 139 |                     $human = _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdminFile.RENAMEDFILE', "Replaced file"); | 
            ||
| 140 |                 } else { | 
            ||
| 141 | $human = false;  | 
            ||
| 142 | }  | 
            ||
| 143 |             } else { | 
            ||
| 144 | $human = false;  | 
            ||
| 145 | }  | 
            ||
| 146 | |||
| 147 |             if($human) { | 
            ||
| 148 | $output[] = $human;  | 
            ||
| 149 | }  | 
            ||
| 150 | }  | 
            ||
| 151 | |||
| 152 |         return implode(", ", $output); | 
            ||
| 153 | }  | 
            ||
| 154 | }  | 
            ||
| 155 | 
This check marks private properties in classes that are never used. Those properties can be removed.