| Conditions | 1 |
| Paths | 1 |
| Total Lines | 64 |
| Code Lines | 56 |
| 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 |
||
| 95 | protected function createPoolRoom(User $user): bool |
||
| 96 | { |
||
| 97 | $room = (new Room)->store("{$user->name}'s room'", "{$user->name} has entered the building", 'model_h', 25, 12, 307, 3104, 1.10); |
||
| 98 | $room->save(); |
||
| 99 | |||
| 100 | DB::table('users')->where('id', $user->uniqueId)->update(['home_room' => $room->id]); |
||
| 101 | |||
| 102 | DB::table('items')->insert( |
||
| 103 | ['room_id' => $room->id, 'item_id' => 16715, 'x' => 5, 'y' => 11, 'z' => 1.30000, 'rot' => 0, 'extra_data' => ''], |
||
| 104 | ['room_id' => $room->id, 'item_id' => 16732, 'x' => 3, 'y' => 10, 'z' => 0.40000, 'rot' => 0, 'extra_data' => ''], |
||
| 105 | ['room_id' => $room->id, 'item_id' => 17016, 'x' => 3, 'y' => 9, 'z' => 0.00000, 'rot' => 2, 'extra_data' => '1'], |
||
| 106 | ['room_id' => $room->id, 'item_id' => 17016, 'x' => 3, 'y' => 11, 'z' => 0.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 107 | ['room_id' => $room->id, 'item_id' => 17016, 'x' => 4, 'y' => 9, 'z' => 0.00000, 'rot' => 4, 'extra_data' => ''], |
||
| 108 | ['room_id' => $room->id, 'item_id' => 17090, 'x' => 3, 'y' => 9, 'z' => 0.00000, 'rot' => 2, 'extra_data' => '1'], |
||
| 109 | ['room_id' => $room->id, 'item_id' => 17176, 'x' => 3, 'y' => 9, 'z' => 0.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 110 | ['room_id' => $room->id, 'item_id' => 17176, 'x' => 3, 'y' => 9, 'z' => 0.40000, 'rot' => 0, 'extra_data' => ''], |
||
| 111 | ['room_id' => $room->id, 'item_id' => 17176, 'x' => 3, 'y' => 10, 'z' => 0.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 112 | ['room_id' => $room->id, 'item_id' => 17190, 'x' => 3, 'y' => 11, 'z' => 0.00000, 'rot' => 2, 'extra_data' => ''], |
||
| 113 | ['room_id' => $room->id, 'item_id' => 17190, 'x' => 4, 'y' => 9, 'z' => 0.00000, 'rot' => 4, 'extra_data' => ''], |
||
| 114 | ['room_id' => $room->id, 'item_id' => 17191, 'x' => 3, 'y' => 10, 'z' => 0.40000, 'rot' => 2, 'extra_data' => ''], |
||
| 115 | ['room_id' => $room->id, 'item_id' => 17191, 'x' => 3, 'y' => 12, 'z' => 0.00000, 'rot' => 2, 'extra_data' => ''], |
||
| 116 | ['room_id' => $room->id, 'item_id' => 17484, 'x' => 8, 'y' => 3, 'z' => 1.00000, 'rot' => 0, 'extra_data' => '0'], |
||
| 117 | ['room_id' => $room->id, 'item_id' => 17499, 'x' => 7, 'y' => 3, 'z' => 1.00000, 'rot' => 2, 'extra_data' => ''], |
||
| 118 | ['room_id' => $room->id, 'item_id' => 17520, 'x' => 7, 'y' => 2, 'z' => 1.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 119 | ['room_id' => $room->id, 'item_id' => 17520, 'x' => 7, 'y' => 4, 'z' => 1.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 120 | ['room_id' => $room->id, 'item_id' => 17520, 'x' => 7, 'y' => 5, 'z' => 1.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 121 | ['room_id' => $room->id, 'item_id' => 17520, 'x' => 8, 'y' => 2, 'z' => 1.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 122 | ['room_id' => $room->id, 'item_id' => 17520, 'x' => 8, 'y' => 5, 'z' => 1.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 123 | ['room_id' => $room->id, 'item_id' => 17520, 'x' => 9, 'y' => 2, 'z' => 1.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 124 | ['room_id' => $room->id, 'item_id' => 17520, 'x' => 9, 'y' => 5, 'z' => 1.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 125 | ['room_id' => $room->id, 'item_id' => 17520, 'x' => 10, 'y' => 2, 'z' => 1.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 126 | ['room_id' => $room->id, 'item_id' => 17520, 'x' => 10, 'y' => 3, 'z' => 1.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 127 | ['room_id' => $room->id, 'item_id' => 17520, 'x' => 10, 'y' => 4, 'z' => 1.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 128 | ['room_id' => $room->id, 'item_id' => 17520, 'x' => 10, 'y' => 5, 'z' => 1.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 129 | ['room_id' => $room->id, 'item_id' => 17987, 'x' => 5, 'y' => 11, 'z' => 0.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 130 | ['room_id' => $room->id, 'item_id' => 18051, 'x' => 5, 'y' => 2, 'z' => 1.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 131 | ['room_id' => $room->id, 'item_id' => 18051, 'x' => 5, 'y' => 4, 'z' => 1.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 132 | ['room_id' => $room->id, 'item_id' => 18051, 'x' => 8, 'y' => 9, 'z' => 0.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 133 | ['room_id' => $room->id, 'item_id' => 18051, 'x' => 8, 'y' => 11, 'z' => 0.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 134 | ['room_id' => $room->id, 'item_id' => 18051, 'x' => 9, 'y' => 9, 'z' => 0.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 135 | ['room_id' => $room->id, 'item_id' => 18051, 'x' => 9, 'y' => 11, 'z' => 0.00000, 'rot' => 0, 'extra_data' => ''], |
||
| 136 | ['room_id' => $room->id, 'item_id' => 18061, 'x' => 8, 'y' => 8, 'z' => 0.00000, 'rot' => 2, 'extra_data' => ''], |
||
| 137 | ['room_id' => $room->id, 'item_id' => 18061, 'x' => 8, 'y' => 9, 'z' => 0.00000, 'rot' => 6, 'extra_data' => '1'], |
||
| 138 | ['room_id' => $room->id, 'item_id' => 18061, 'x' => 10, 'y' => 8, 'z' => 0.00000, 'rot' => 4, 'extra_data' => '1'], |
||
| 139 | ['room_id' => $room->id, 'item_id' => 18070, 'x' => 8, 'y' => 2, 'z' => 1.50000, 'rot' => 0, 'extra_data' => '1'], |
||
| 140 | ['room_id' => $room->id, 'item_id' => 18079, 'x' => 9, 'y' => 8, 'z' => 0.00000, 'rot' => 0, 'extra_data' => '1'], |
||
| 141 | ['room_id' => $room->id, 'item_id' => 18363, 'x' => 3, 'y' => 9, 'z' => 0.80000, 'rot' => 0, 'extra_data' => '2'] |
||
| 142 | ); |
||
| 143 | |||
| 144 | DB::table('items')->insert( |
||
| 145 | ['room_id' => $room->id, 'item_id' => 22996, 'wall_pos' => ':w=4,8 l=7,45 r', 'extra_data' => ''], |
||
| 146 | ['room_id' => $room->id, 'item_id' => 22996, 'wall_pos' => ':w=4,8 l=9,45 l', 'extra_data' => ''], |
||
| 147 | ['room_id' => $room->id, 'item_id' => 23063, 'wall_pos' => ':w=2,10 l=10,56 l', 'extra_data' => ''], |
||
| 148 | ['room_id' => $room->id, 'item_id' => 23063, 'wall_pos' => ':w=2,11 l=6,58 l', 'extra_data' => ''], |
||
| 149 | ['room_id' => $room->id, 'item_id' => 23078, 'wall_pos' => ':w=6,1 l=0,26 r', 'extra_data' => '1'], |
||
| 150 | ['room_id' => $room->id, 'item_id' => 23078, 'wall_pos' => ':w=7,1 l=4,28 r', 'extra_data' => '3'], |
||
| 151 | ['room_id' => $room->id, 'item_id' => 23078, 'wall_pos' => ':w=8,1 l=13,33 r', 'extra_data' => '1'], |
||
| 152 | ['room_id' => $room->id, 'item_id' => 23078, 'wall_pos' => ':w=10,1 l=0,26 r', 'extra_data' => '3'], |
||
| 153 | ['room_id' => $room->id, 'item_id' => 23229, 'wall_pos' => ':w=4,3 l=6,49 l', 'extra_data' => '1'], |
||
| 154 | ['room_id' => $room->id, 'item_id' => 23229, 'wall_pos' => ':w=4,5 l=11,45 l', 'extra_data' => '1'] |
||
| 155 | ); |
||
| 156 | |||
| 157 | return true; |
||
| 158 | } |
||
| 159 | |||
| 205 | } |