| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 62 | 
| Code Lines | 46 | 
| 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 testGetTopBehaviors() { | 
            ||
| 108 | $this  | 
            ||
| 109 | ->user_behavior  | 
            ||
| 110 |       ->method('getBehaviorsWithCounts') | 
            ||
| 111 | ->willReturnOnConsecutiveCalls([], [  | 
            ||
| 112 | [  | 
            ||
| 113 | 'user_id' => 1,  | 
            ||
| 114 | 'behavior_id' => 1,  | 
            ||
| 115 | 'count' => 5  | 
            ||
| 116 | ], [  | 
            ||
| 117 | 'user_id' => 1,  | 
            ||
| 118 | 'behavior_id' => 2,  | 
            ||
| 119 | 'count' => 4  | 
            ||
| 120 | ], [  | 
            ||
| 121 | 'user_id' => 1,  | 
            ||
| 122 | 'behavior_id' => 3,  | 
            ||
| 123 | 'count' => 3  | 
            ||
| 124 | ]  | 
            ||
| 125 | ]);  | 
            ||
| 126 | |||
| 127 |     expect('getTopBehaviors to return the empty array if the user has not logged any behaviors', $this->assertEquals([], $this->user_behavior->getTopBehaviors())); | 
            ||
| 128 |     expect('getTopBehaviors to return embelished data corresponding to the most commonly selected behaviors', $this->assertEquals( | 
            ||
| 129 | [[  | 
            ||
| 130 | 'user_id' => 1,  | 
            ||
| 131 | 'behavior_id' => 1,  | 
            ||
| 132 | 'count' => 5,  | 
            ||
| 133 | 'behavior' => [  | 
            ||
| 134 | 'id' => 1,  | 
            ||
| 135 | 'name' => 'no current secrets',  | 
            ||
| 136 | 'category_id' => 1,  | 
            ||
| 137 | 'category' => [  | 
            ||
| 138 | 'id' => 1,  | 
            ||
| 139 | 'name' => 'Restoration',  | 
            ||
| 140 | ],  | 
            ||
| 141 | ],  | 
            ||
| 142 | ], [  | 
            ||
| 143 | 'user_id' => 1,  | 
            ||
| 144 | 'behavior_id' => 2,  | 
            ||
| 145 | 'count' => 4,  | 
            ||
| 146 | 'behavior' => [  | 
            ||
| 147 | 'id' => 2,  | 
            ||
| 148 | 'name' => 'resolving problems',  | 
            ||
| 149 | 'category_id' => 1,  | 
            ||
| 150 | 'category' => [  | 
            ||
| 151 | 'id' => 1,  | 
            ||
| 152 | 'name' => 'Restoration',  | 
            ||
| 153 | ],  | 
            ||
| 154 | ],  | 
            ||
| 155 | ], [  | 
            ||
| 156 | 'user_id' => 1,  | 
            ||
| 157 | 'behavior_id' => 3,  | 
            ||
| 158 | 'count' => 3,  | 
            ||
| 159 | 'behavior' => [  | 
            ||
| 160 | 'id' => 3,  | 
            ||
| 161 | 'name' => 'identifying fears and feelings',  | 
            ||
| 162 | 'category_id' => 1,  | 
            ||
| 163 | 'category' => [  | 
            ||
| 164 | 'id' => 1,  | 
            ||
| 165 | 'name' => 'Restoration',  | 
            ||
| 166 | ],  | 
            ||
| 167 | ],  | 
            ||
| 168 | ]], $this->user_behavior->getTopBehaviors()));  | 
            ||
| 169 | }  | 
            ||
| 214 |