| Conditions | 9 |
| Paths | 9 |
| Total Lines | 94 |
| Code Lines | 71 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 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 |
||
| 154 | public function unshare(array $params) { |
||
| 155 | if($params['shareType'] === Share::SHARE_TYPE_LINK) { |
||
| 156 | $this->log( |
||
| 157 | 'The %s "%s" with ID "%s" has been unshared (Share ID: %s)', |
||
| 158 | $params, |
||
| 159 | [ |
||
| 160 | 'itemType', |
||
| 161 | 'fileTarget', |
||
| 162 | 'itemSource', |
||
| 163 | 'id', |
||
| 164 | ] |
||
| 165 | ); |
||
| 166 | } elseif($params['shareType'] === Share::SHARE_TYPE_USER) { |
||
| 167 | $this->log( |
||
| 168 | 'The %s "%s" with ID "%s" has been unshared from the user "%s" (Share ID: %s)', |
||
| 169 | $params, |
||
| 170 | [ |
||
| 171 | 'itemType', |
||
| 172 | 'fileTarget', |
||
| 173 | 'itemSource', |
||
| 174 | 'shareWith', |
||
| 175 | 'id', |
||
| 176 | ] |
||
| 177 | ); |
||
| 178 | } elseif($params['shareType'] === Share::SHARE_TYPE_GROUP) { |
||
| 179 | $this->log( |
||
| 180 | 'The %s "%s" with ID "%s" has been unshared from the group "%s" (Share ID: %s)', |
||
| 181 | $params, |
||
| 182 | [ |
||
| 183 | 'itemType', |
||
| 184 | 'fileTarget', |
||
| 185 | 'itemSource', |
||
| 186 | 'shareWith', |
||
| 187 | 'id', |
||
| 188 | ] |
||
| 189 | ); |
||
| 190 | } elseif($params['shareType'] === Share::SHARE_TYPE_ROOM) { |
||
| 191 | $this->log( |
||
| 192 | 'The %s "%s" with ID "%s" has been unshared from the room "%s" (Share ID: %s)', |
||
| 193 | $params, |
||
| 194 | [ |
||
| 195 | 'itemType', |
||
| 196 | 'fileTarget', |
||
| 197 | 'itemSource', |
||
| 198 | 'shareWith', |
||
| 199 | 'id', |
||
| 200 | ] |
||
| 201 | ); |
||
| 202 | } elseif($params['shareType'] === Share::SHARE_TYPE_EMAIL) { |
||
| 203 | $this->log( |
||
| 204 | 'The %s "%s" with ID "%s" has been unshared from the email recipient "%s" (Share ID: %s)', |
||
| 205 | $params, |
||
| 206 | [ |
||
| 207 | 'itemType', |
||
| 208 | 'fileTarget', |
||
| 209 | 'itemSource', |
||
| 210 | 'shareWith', |
||
| 211 | 'id', |
||
| 212 | ] |
||
| 213 | ); |
||
| 214 | } elseif($params['shareType'] === Share::SHARE_TYPE_CIRCLE) { |
||
| 215 | $this->log( |
||
| 216 | 'The %s "%s" with ID "%s" has been unshared from the circle "%s" (Share ID: %s)', |
||
| 217 | $params, |
||
| 218 | [ |
||
| 219 | 'itemType', |
||
| 220 | 'fileTarget', |
||
| 221 | 'itemSource', |
||
| 222 | 'shareWith', |
||
| 223 | 'id', |
||
| 224 | ] |
||
| 225 | ); |
||
| 226 | } elseif($params['shareType'] === Share::SHARE_TYPE_REMOTE) { |
||
| 227 | $this->log( |
||
| 228 | 'The %s "%s" with ID "%s" has been unshared from the remote user "%s" (Share ID: %s)', |
||
| 229 | $params, |
||
| 230 | [ |
||
| 231 | 'itemType', |
||
| 232 | 'fileTarget', |
||
| 233 | 'itemSource', |
||
| 234 | 'shareWith', |
||
| 235 | 'id', |
||
| 236 | ] |
||
| 237 | ); |
||
| 238 | } elseif($params['shareType'] === Share::SHARE_TYPE_REMOTE_GROUP) { |
||
| 239 | $this->log( |
||
| 240 | 'The %s "%s" with ID "%s" has been unshared from the remote group "%s" (Share ID: %s)', |
||
| 241 | $params, |
||
| 242 | [ |
||
| 243 | 'itemType', |
||
| 244 | 'fileTarget', |
||
| 245 | 'itemSource', |
||
| 246 | 'shareWith', |
||
| 247 | 'id', |
||
| 248 | ] |
||
| 322 |