| Conditions | 2 |
| Paths | 2 |
| Total Lines | 65 |
| Code Lines | 45 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| 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 |
||
| 107 | public static function statusProvider() |
||
| 108 | { |
||
| 109 | if (!class_exists('ZendDiagnostics\Result\Success')) { |
||
| 110 | return array(array(1, 1, 1)); |
||
| 111 | } |
||
| 112 | |||
| 113 | $data = array(); |
||
| 114 | |||
| 115 | $data[] = array( |
||
| 116 | array( |
||
| 117 | MessageInterface::STATE_IN_PROGRESS => 11, #here |
||
| 118 | MessageInterface::STATE_ERROR => 31, |
||
| 119 | MessageInterface::STATE_OPEN => 100, |
||
| 120 | MessageInterface::STATE_DONE => 10000, |
||
| 121 | ), |
||
| 122 | new Failure(), |
||
| 123 | 'Too many messages processed at the same time (Database)', |
||
| 124 | ); |
||
| 125 | |||
| 126 | $data[] = array( |
||
| 127 | array( |
||
| 128 | MessageInterface::STATE_IN_PROGRESS => 1, |
||
| 129 | MessageInterface::STATE_ERROR => 31, #here |
||
| 130 | MessageInterface::STATE_OPEN => 100, |
||
| 131 | MessageInterface::STATE_DONE => 10000, |
||
| 132 | ), |
||
| 133 | new Failure(), |
||
| 134 | 'Too many errors (Database)', |
||
| 135 | ); |
||
| 136 | |||
| 137 | $data[] = array( |
||
| 138 | array( |
||
| 139 | MessageInterface::STATE_IN_PROGRESS => 1, |
||
| 140 | MessageInterface::STATE_ERROR => 1, |
||
| 141 | MessageInterface::STATE_OPEN => 101, #here |
||
| 142 | MessageInterface::STATE_DONE => 10000, |
||
| 143 | ), |
||
| 144 | new Warning(), |
||
| 145 | 'Too many messages waiting to be processed (Database)', |
||
| 146 | ); |
||
| 147 | |||
| 148 | $data[] = array( |
||
| 149 | array( |
||
| 150 | MessageInterface::STATE_IN_PROGRESS => 1, |
||
| 151 | MessageInterface::STATE_ERROR => 1, |
||
| 152 | MessageInterface::STATE_OPEN => 100, |
||
| 153 | MessageInterface::STATE_DONE => 10001, #here |
||
| 154 | ), |
||
| 155 | new Warning(), |
||
| 156 | 'Too many processed messages, please clean the database (Database)', |
||
| 157 | ); |
||
| 158 | |||
| 159 | $data[] = array( |
||
| 160 | array( |
||
| 161 | MessageInterface::STATE_IN_PROGRESS => 1, |
||
| 162 | MessageInterface::STATE_ERROR => 1, |
||
| 163 | MessageInterface::STATE_OPEN => 1, |
||
| 164 | MessageInterface::STATE_DONE => 1, |
||
| 165 | ), |
||
| 166 | new Success(), |
||
| 167 | 'Ok (Database)', |
||
| 168 | ); |
||
| 169 | |||
| 170 | return $data; |
||
| 171 | } |
||
| 172 | } |
||
| 173 |