| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 87 | 
| Code Lines | 77 | 
| 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  | 
            ||
| 180 | public function testSlicedDataSource()  | 
            ||
| 181 |     { | 
            ||
| 182 | $this  | 
            ||
| 183 | ->given($emptyDataSource = $this->emptyDataSource())  | 
            ||
| 184 | ->then  | 
            ||
| 185 | ->boolean($emptyDataSource->isSliced())  | 
            ||
| 186 | ->isFalse()  | 
            ||
| 187 | ->and  | 
            ||
| 188 | ->when($slicedDataSource = $emptyDataSource->slicedDataSource(2))  | 
            ||
| 189 | ->then  | 
            ||
| 190 | ->boolean($slicedDataSource->isSliced())  | 
            ||
| 191 | ->isTrue()  | 
            ||
| 192 | ->integer($slicedDataSource->offset())  | 
            ||
| 193 | ->isEqualTo(2)  | 
            ||
| 194 | ->variable($slicedDataSource->length())  | 
            ||
| 195 | ->isNull()  | 
            ||
| 196 | ;  | 
            ||
| 197 | |||
| 198 | $this  | 
            ||
| 199 | ->given($randomDataSource = $this->randomDataSource(null, null, 2, 10))  | 
            ||
| 200 | ->then  | 
            ||
| 201 | ->boolean($randomDataSource->isSliced())  | 
            ||
| 202 | ->isTrue()  | 
            ||
| 203 | ->integer($randomDataSource->offset())  | 
            ||
| 204 | ->isEqualTo(2)  | 
            ||
| 205 | ->integer($randomDataSource->length())  | 
            ||
| 206 | ->isEqualTo(10)  | 
            ||
| 207 | ->and  | 
            ||
| 208 | ->when($slicedDataSource = $randomDataSource->slicedDataSource(2, 4))  | 
            ||
| 209 | ->then  | 
            ||
| 210 | ->boolean($slicedDataSource->isSliced())  | 
            ||
| 211 | ->isTrue()  | 
            ||
| 212 | ->integer($slicedDataSource->offset())  | 
            ||
| 213 | ->isEqualTo(4)  | 
            ||
| 214 | ->integer($slicedDataSource->length())  | 
            ||
| 215 | ->isEqualTo(4)  | 
            ||
| 216 | ;  | 
            ||
| 217 | |||
| 218 | $this  | 
            ||
| 219 | ->given($randomDataSource = $this->randomDataSource(null, null, 2, 10))  | 
            ||
| 220 | ->then  | 
            ||
| 221 | ->boolean($randomDataSource->isSliced())  | 
            ||
| 222 | ->isTrue()  | 
            ||
| 223 | ->integer($randomDataSource->offset())  | 
            ||
| 224 | ->isEqualTo(2)  | 
            ||
| 225 | ->integer($randomDataSource->length())  | 
            ||
| 226 | ->isEqualTo(10)  | 
            ||
| 227 | ->and  | 
            ||
| 228 | ->when($slicedDataSource = $randomDataSource->slicedDataSource(8, 4))  | 
            ||
| 229 | ->then  | 
            ||
| 230 | ->boolean($slicedDataSource->isSliced())  | 
            ||
| 231 | ->isTrue()  | 
            ||
| 232 | ->integer($slicedDataSource->offset())  | 
            ||
| 233 | ->isEqualTo(10)  | 
            ||
| 234 | ->integer($slicedDataSource->length())  | 
            ||
| 235 | ->isEqualTo(2)  | 
            ||
| 236 | ;  | 
            ||
| 237 | |||
| 238 | $this  | 
            ||
| 239 | ->given($randomDataSource = $this->randomDataSource(null, null, 2, 4))  | 
            ||
| 240 | ->then  | 
            ||
| 241 | ->boolean($randomDataSource->isSliced())  | 
            ||
| 242 | ->isTrue()  | 
            ||
| 243 | ->variable($randomDataSource->offset())  | 
            ||
| 244 | ->isEqualTo(2)  | 
            ||
| 245 | ->variable($randomDataSource->length())  | 
            ||
| 246 | ->isEqualTo(4)  | 
            ||
| 247 | ->and  | 
            ||
| 248 | ->when($slicedDataSource = $randomDataSource->slicedDataSource(8, 4))  | 
            ||
| 249 | ->then  | 
            ||
| 250 | ->boolean($slicedDataSource->isSliced())  | 
            ||
| 251 | ->isTrue()  | 
            ||
| 252 | ->variable($slicedDataSource->offset())  | 
            ||
| 253 | ->isEqualTo(10)  | 
            ||
| 254 | ->variable($slicedDataSource->length())  | 
            ||
| 255 | ->isEqualTo(0)  | 
            ||
| 256 | ;  | 
            ||
| 257 | |||
| 258 | $this  | 
            ||
| 259 | ->given($randomDataSource = $this->randomDataSource(null, null, 2, 4))  | 
            ||
| 260 | ->let($iterator = $randomDataSource->getIterator())  | 
            ||
| 261 | ->then()  | 
            ||
| 262 | ->object($iterator)  | 
            ||
| 263 | ->isInstanceOf(\Traversable::class)  | 
            ||
| 264 | ->integer(\iterator_count($iterator))  | 
            ||
| 265 | ->isEqualTo(4);  | 
            ||
| 266 | }  | 
            ||
| 267 | |||
| 291 |