| Conditions | 1 |
| Paths | 1 |
| Total Lines | 163 |
| 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 |
||
| 24 | public function provideData(): array |
||
| 25 | { |
||
| 26 | $provider = new ItemStructuresProvider(); |
||
| 27 | |||
| 28 | return [ |
||
| 29 | 'user' => [ |
||
| 30 | $provider->getUserStructure(), |
||
| 31 | [ |
||
| 32 | 'id' => '', |
||
| 33 | 'type' => '', |
||
| 34 | 'attributes' => [ |
||
| 35 | 'uid' => '', |
||
| 36 | 'firstName' => '', |
||
| 37 | 'lastName' => '', |
||
| 38 | 'fullName' => '', |
||
| 39 | 'email' => '', |
||
| 40 | 'avatar' => '', |
||
| 41 | 'photoUrl' => '', |
||
| 42 | ], |
||
| 43 | ], |
||
| 44 | ], |
||
| 45 | 'user_with_profiles' => [ |
||
| 46 | $provider->getUserStructure(['[profiles:userProfile]']), |
||
| 47 | [ |
||
| 48 | 'id' => '', |
||
| 49 | 'type' => '', |
||
| 50 | 'attributes' => [ |
||
| 51 | 'uid' => '', |
||
| 52 | 'firstName' => '', |
||
| 53 | 'lastName' => '', |
||
| 54 | 'fullName' => '', |
||
| 55 | 'email' => '', |
||
| 56 | 'avatar' => '', |
||
| 57 | 'photoUrl' => '', |
||
| 58 | ], |
||
| 59 | 'relationships' => [ |
||
| 60 | 'profiles' => [ |
||
| 61 | 'data' => [ |
||
| 62 | [ |
||
| 63 | 'type' => '', |
||
| 64 | 'id' => '', |
||
| 65 | 'attributes' => [ |
||
| 66 | 'type' => '', |
||
| 67 | 'degree' => '', |
||
| 68 | ], |
||
| 69 | ], |
||
| 70 | ], |
||
| 71 | ], |
||
| 72 | ], |
||
| 73 | ], |
||
| 74 | ], |
||
| 75 | 'user_with_profiles_and_status' => [ |
||
| 76 | $provider->getUserStructure([ |
||
| 77 | '[profiles:userProfile]', |
||
| 78 | '[profiles].profileStatus', |
||
| 79 | ]), |
||
| 80 | [ |
||
| 81 | 'id' => '', |
||
| 82 | 'type' => '', |
||
| 83 | 'attributes' => [ |
||
| 84 | 'uid' => '', |
||
| 85 | 'firstName' => '', |
||
| 86 | 'lastName' => '', |
||
| 87 | 'fullName' => '', |
||
| 88 | 'email' => '', |
||
| 89 | 'avatar' => '', |
||
| 90 | 'photoUrl' => '', |
||
| 91 | ], |
||
| 92 | 'relationships' => [ |
||
| 93 | 'profiles' => [ |
||
| 94 | 'data' => [ |
||
| 95 | [ |
||
| 96 | 'type' => '', |
||
| 97 | 'id' => '', |
||
| 98 | 'attributes' => [ |
||
| 99 | 'type' => '', |
||
| 100 | 'degree' => '', |
||
| 101 | ], |
||
| 102 | 'relationships' => [ |
||
| 103 | 'profileStatus' => [ |
||
| 104 | 'data' => [ |
||
| 105 | 'type' => '', |
||
| 106 | 'id' => '', |
||
| 107 | 'attributes' => [ |
||
| 108 | 'status' => '', |
||
| 109 | 'message' => '', |
||
| 110 | ], |
||
| 111 | ], |
||
| 112 | ], |
||
| 113 | ], |
||
| 114 | ], |
||
| 115 | ], |
||
| 116 | ], |
||
| 117 | ], |
||
| 118 | ], |
||
| 119 | ], |
||
| 120 | 'user_with_profiles_and_status_and_sub_sub' => [ |
||
| 121 | $provider->getUserStructure([ |
||
| 122 | '[profiles:userProfile]', |
||
| 123 | '[profiles].profileStatus', |
||
| 124 | '[profiles].profileStatus.[lecturers:user]', |
||
| 125 | ]), |
||
| 126 | [ |
||
| 127 | 'id' => '', |
||
| 128 | 'type' => '', |
||
| 129 | 'attributes' => [ |
||
| 130 | 'uid' => '', |
||
| 131 | 'firstName' => '', |
||
| 132 | 'lastName' => '', |
||
| 133 | 'fullName' => '', |
||
| 134 | 'email' => '', |
||
| 135 | 'avatar' => '', |
||
| 136 | 'photoUrl' => '', |
||
| 137 | ], |
||
| 138 | 'relationships' => [ |
||
| 139 | 'profiles' => [ |
||
| 140 | 'data' => [ |
||
| 141 | [ |
||
| 142 | 'type' => '', |
||
| 143 | 'id' => '', |
||
| 144 | 'attributes' => [ |
||
| 145 | 'type' => '', |
||
| 146 | 'degree' => '', |
||
| 147 | ], |
||
| 148 | 'relationships' => [ |
||
| 149 | 'profileStatus' => [ |
||
| 150 | 'data' => [ |
||
| 151 | 'type' => '', |
||
| 152 | 'id' => '', |
||
| 153 | 'attributes' => [ |
||
| 154 | 'status' => '', |
||
| 155 | 'message' => '', |
||
| 156 | ], |
||
| 157 | 'relationships' => [ |
||
| 158 | 'lecturers' => [ |
||
| 159 | 'data' => [ |
||
| 160 | [ |
||
| 161 | 'id' => '', |
||
| 162 | 'type' => '', |
||
| 163 | 'attributes' => [ |
||
| 164 | 'uid' => '', |
||
| 165 | 'firstName' => '', |
||
| 166 | 'lastName' => '', |
||
| 167 | 'fullName' => '', |
||
| 168 | 'email' => '', |
||
| 169 | 'avatar' => '', |
||
| 170 | 'photoUrl' => '', |
||
| 171 | ], |
||
| 172 | ], |
||
| 173 | ], |
||
| 174 | ], |
||
| 175 | ], |
||
| 176 | ], |
||
| 177 | ], |
||
| 178 | ], |
||
| 179 | ], |
||
| 180 | ], |
||
| 181 | ], |
||
| 182 | ], |
||
| 183 | ], |
||
| 184 | ], |
||
| 185 | ]; |
||
| 186 | } |
||
| 187 | |||
| 209 |