| Conditions | 2 |
| Paths | 2 |
| Total Lines | 61 |
| Code Lines | 57 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 57 |
| CRAP Score | 2 |
| 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 |
||
| 30 | 64 | public static function all(): MapInterface |
|
| 31 | { |
||
| 32 | 64 | if (!self::$all instanceof MapInterface) { |
|
| 33 | 1 | self::$all = (new Map('string', Method::class)) |
|
| 34 | 1 | ->put('connection.start', new Method(10, 10)) |
|
|
2 ignored issues
–
show
|
|||
| 35 | 1 | ->put('connection.start-ok', new Method(10, 11)) |
|
|
2 ignored issues
–
show
|
|||
| 36 | 1 | ->put('connection.secure', new Method(10, 20)) |
|
|
2 ignored issues
–
show
|
|||
| 37 | 1 | ->put('connection.secure-ok', new Method(10, 21)) |
|
|
2 ignored issues
–
show
|
|||
| 38 | 1 | ->put('connection.tune', new Method(10, 30)) |
|
|
2 ignored issues
–
show
|
|||
| 39 | 1 | ->put('connection.tune-ok', new Method(10, 31)) |
|
|
2 ignored issues
–
show
|
|||
| 40 | 1 | ->put('connection.open', new Method(10, 40)) |
|
|
2 ignored issues
–
show
|
|||
| 41 | 1 | ->put('connection.open-ok', new Method(10, 41)) |
|
|
2 ignored issues
–
show
|
|||
| 42 | 1 | ->put('connection.close', new Method(10, 50)) |
|
|
2 ignored issues
–
show
|
|||
| 43 | 1 | ->put('connection.close-ok', new Method(10, 51)) |
|
|
2 ignored issues
–
show
|
|||
| 44 | 1 | ->put('channel.open', new Method(20, 10)) |
|
|
2 ignored issues
–
show
|
|||
| 45 | 1 | ->put('channel.open-ok', new Method(20, 11)) |
|
|
2 ignored issues
–
show
|
|||
| 46 | 1 | ->put('channel.flow', new Method(20, 20)) |
|
|
2 ignored issues
–
show
|
|||
| 47 | 1 | ->put('channel.flow-ok', new Method(20, 21)) |
|
|
2 ignored issues
–
show
|
|||
| 48 | 1 | ->put('channel.close', new Method(20, 40)) |
|
|
2 ignored issues
–
show
|
|||
| 49 | 1 | ->put('channel.close-ok', new Method(20, 41)) |
|
|
2 ignored issues
–
show
|
|||
| 50 | 1 | ->put('exchange.declare', new Method(40, 10)) |
|
|
2 ignored issues
–
show
|
|||
| 51 | 1 | ->put('exchange.declare-ok', new Method(40, 11)) |
|
|
2 ignored issues
–
show
|
|||
| 52 | 1 | ->put('exchange.delete', new Method(40, 20)) |
|
|
2 ignored issues
–
show
|
|||
| 53 | 1 | ->put('exchange.delete-ok', new Method(40, 21)) |
|
|
2 ignored issues
–
show
|
|||
| 54 | 1 | ->put('queue.declare', new Method(50, 10)) |
|
|
2 ignored issues
–
show
|
|||
| 55 | 1 | ->put('queue.declare-ok', new Method(50, 11)) |
|
|
2 ignored issues
–
show
|
|||
| 56 | 1 | ->put('queue.bind', new Method(50, 20)) |
|
|
2 ignored issues
–
show
|
|||
| 57 | 1 | ->put('queue.bind-ok', new Method(50, 21)) |
|
|
2 ignored issues
–
show
|
|||
| 58 | 1 | ->put('queue.unbind', new Method(50, 50)) |
|
|
2 ignored issues
–
show
|
|||
| 59 | 1 | ->put('queue.unbind-ok', new Method(50, 51)) |
|
|
2 ignored issues
–
show
|
|||
| 60 | 1 | ->put('queue.purge', new Method(50, 30)) |
|
|
2 ignored issues
–
show
|
|||
| 61 | 1 | ->put('queue.purge-ok', new Method(50, 31)) |
|
|
2 ignored issues
–
show
|
|||
| 62 | 1 | ->put('queue.delete', new Method(50, 40)) |
|
|
2 ignored issues
–
show
|
|||
| 63 | 1 | ->put('queue.delete-ok', new Method(50, 41)) |
|
|
2 ignored issues
–
show
|
|||
| 64 | 1 | ->put('basic.qos', new Method(60, 10)) |
|
|
2 ignored issues
–
show
|
|||
| 65 | 1 | ->put('basic.qos-ok', new Method(60, 11)) |
|
|
2 ignored issues
–
show
|
|||
| 66 | 1 | ->put('basic.consume', new Method(60, 20)) |
|
|
2 ignored issues
–
show
|
|||
| 67 | 1 | ->put('basic.consume-ok', new Method(60, 21)) |
|
|
2 ignored issues
–
show
|
|||
| 68 | 1 | ->put('basic.cancel', new Method(60, 30)) |
|
|
2 ignored issues
–
show
|
|||
| 69 | 1 | ->put('basic.cancel-ok', new Method(60, 31)) |
|
|
2 ignored issues
–
show
|
|||
| 70 | 1 | ->put('basic.publish', new Method(60, 40)) |
|
|
2 ignored issues
–
show
|
|||
| 71 | 1 | ->put('basic.return', new Method(60, 50)) |
|
|
2 ignored issues
–
show
|
|||
| 72 | 1 | ->put('basic.deliver', new Method(60, 60)) |
|
|
2 ignored issues
–
show
|
|||
| 73 | 1 | ->put('basic.get', new Method(60, 70)) |
|
|
2 ignored issues
–
show
|
|||
| 74 | 1 | ->put('basic.get-ok', new Method(60, 71)) |
|
|
2 ignored issues
–
show
|
|||
| 75 | 1 | ->put('basic.get-empty', new Method(60, 72)) |
|
|
2 ignored issues
–
show
|
|||
| 76 | 1 | ->put('basic.ack', new Method(60, 80)) |
|
|
2 ignored issues
–
show
|
|||
| 77 | 1 | ->put('basic.reject', new Method(60, 90)) |
|
|
2 ignored issues
–
show
|
|||
| 78 | 1 | ->put('basic.recover-async', new Method(60, 100)) |
|
|
2 ignored issues
–
show
|
|||
| 79 | 1 | ->put('basic.recover', new Method(60, 110)) |
|
|
2 ignored issues
–
show
|
|||
| 80 | 1 | ->put('basic.recover-ok', new Method(60, 111)) |
|
|
2 ignored issues
–
show
|
|||
| 81 | 1 | ->put('tx.select', new Method(90, 10)) |
|
|
2 ignored issues
–
show
|
|||
| 82 | 1 | ->put('tx.select-ok', new Method(90, 11)) |
|
|
2 ignored issues
–
show
|
|||
| 83 | 1 | ->put('tx.commit', new Method(90, 20)) |
|
|
2 ignored issues
–
show
|
|||
| 84 | 1 | ->put('tx.commit-ok', new Method(90, 21)) |
|
|
2 ignored issues
–
show
|
|||
| 85 | 1 | ->put('tx.rollback', new Method(90, 30)) |
|
|
2 ignored issues
–
show
|
|||
| 86 | 1 | ->put('tx.rollback-ok', new Method(90, 31)); |
|
|
2 ignored issues
–
show
|
|||
| 87 | } |
||
| 88 | |||
| 89 | 64 | return self::$all; |
|
| 90 | } |
||
| 91 | |||
| 110 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: