| Conditions | 10 |
| Paths | 10 |
| Total Lines | 106 |
| Code Lines | 80 |
| 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 |
||
| 170 | public function unshare(array $params) { |
||
| 171 | if ($params['shareType'] === IShare::TYPE_LINK) { |
||
| 172 | $this->log( |
||
| 173 | 'The %s "%s" with ID "%s" has been unshared (Share ID: %s)', |
||
| 174 | $params, |
||
| 175 | [ |
||
| 176 | 'itemType', |
||
| 177 | 'fileTarget', |
||
| 178 | 'itemSource', |
||
| 179 | 'id', |
||
| 180 | ] |
||
| 181 | ); |
||
| 182 | } elseif ($params['shareType'] === IShare::TYPE_USER) { |
||
| 183 | $this->log( |
||
| 184 | 'The %s "%s" with ID "%s" has been unshared from the user "%s" (Share ID: %s)', |
||
| 185 | $params, |
||
| 186 | [ |
||
| 187 | 'itemType', |
||
| 188 | 'fileTarget', |
||
| 189 | 'itemSource', |
||
| 190 | 'shareWith', |
||
| 191 | 'id', |
||
| 192 | ] |
||
| 193 | ); |
||
| 194 | } elseif ($params['shareType'] === IShare::TYPE_GROUP) { |
||
| 195 | $this->log( |
||
| 196 | 'The %s "%s" with ID "%s" has been unshared from the group "%s" (Share ID: %s)', |
||
| 197 | $params, |
||
| 198 | [ |
||
| 199 | 'itemType', |
||
| 200 | 'fileTarget', |
||
| 201 | 'itemSource', |
||
| 202 | 'shareWith', |
||
| 203 | 'id', |
||
| 204 | ] |
||
| 205 | ); |
||
| 206 | } elseif ($params['shareType'] === IShare::TYPE_ROOM) { |
||
| 207 | $this->log( |
||
| 208 | 'The %s "%s" with ID "%s" has been unshared from the room "%s" (Share ID: %s)', |
||
| 209 | $params, |
||
| 210 | [ |
||
| 211 | 'itemType', |
||
| 212 | 'fileTarget', |
||
| 213 | 'itemSource', |
||
| 214 | 'shareWith', |
||
| 215 | 'id', |
||
| 216 | ] |
||
| 217 | ); |
||
| 218 | } elseif ($params['shareType'] === IShare::TYPE_EMAIL) { |
||
| 219 | $this->log( |
||
| 220 | 'The %s "%s" with ID "%s" has been unshared from the email recipient "%s" (Share ID: %s)', |
||
| 221 | $params, |
||
| 222 | [ |
||
| 223 | 'itemType', |
||
| 224 | 'fileTarget', |
||
| 225 | 'itemSource', |
||
| 226 | 'shareWith', |
||
| 227 | 'id', |
||
| 228 | ] |
||
| 229 | ); |
||
| 230 | } elseif ($params['shareType'] === IShare::TYPE_CIRCLE) { |
||
| 231 | $this->log( |
||
| 232 | 'The %s "%s" with ID "%s" has been unshared from the circle "%s" (Share ID: %s)', |
||
| 233 | $params, |
||
| 234 | [ |
||
| 235 | 'itemType', |
||
| 236 | 'fileTarget', |
||
| 237 | 'itemSource', |
||
| 238 | 'shareWith', |
||
| 239 | 'id', |
||
| 240 | ] |
||
| 241 | ); |
||
| 242 | } elseif ($params['shareType'] === IShare::TYPE_REMOTE) { |
||
| 243 | $this->log( |
||
| 244 | 'The %s "%s" with ID "%s" has been unshared from the remote user "%s" (Share ID: %s)', |
||
| 245 | $params, |
||
| 246 | [ |
||
| 247 | 'itemType', |
||
| 248 | 'fileTarget', |
||
| 249 | 'itemSource', |
||
| 250 | 'shareWith', |
||
| 251 | 'id', |
||
| 252 | ] |
||
| 253 | ); |
||
| 254 | } elseif ($params['shareType'] === IShare::TYPE_REMOTE_GROUP) { |
||
| 255 | $this->log( |
||
| 256 | 'The %s "%s" with ID "%s" has been unshared from the remote group "%s" (Share ID: %s)', |
||
| 257 | $params, |
||
| 258 | [ |
||
| 259 | 'itemType', |
||
| 260 | 'fileTarget', |
||
| 261 | 'itemSource', |
||
| 262 | 'shareWith', |
||
| 263 | 'id', |
||
| 264 | ] |
||
| 265 | ); |
||
| 266 | } elseif ($params['shareType'] === IShare::TYPE_DECK) { |
||
| 267 | $this->log( |
||
| 268 | 'The %s "%s" with ID "%s" has been unshared from the deck card "%s" (Share ID: %s)', |
||
| 269 | $params, |
||
| 270 | [ |
||
| 271 | 'itemType', |
||
| 272 | 'fileTarget', |
||
| 273 | 'itemSource', |
||
| 274 | 'shareWith', |
||
| 275 | 'id', |
||
| 276 | ] |
||
| 350 |