Conditions | 11 |
Paths | 12 |
Total Lines | 56 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 132 |
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 |
||
106 | { |
||
107 | return serialize([ |
||
108 | 'key' => $this->key, |
||
109 | 'recipients' => $this->recipients, |
||
110 | 'params' => $this->params |
||
111 | ]); |
||
112 | } |
||
113 | |||
114 | /** |
||
115 | * @inheritdoc |
||
116 | */ |
||
117 | public function unserialize($serialized) |
||
118 | { |
||
119 | Craft::configure( |
||
120 | $this, |
||
121 | unserialize($serialized) |
||
122 | ); |
||
123 | } |
||
124 | } |
||
125 |