| Conditions | 11 |
| Paths | 8 |
| Total Lines | 31 |
| Code Lines | 19 |
| 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 |
||
| 14 | public function parse() |
||
| 15 | { |
||
| 16 | do { |
||
| 17 | $lineInfo = $this->getStream()->read(); |
||
| 18 | if (null === $lineInfo) { |
||
| 19 | continue; |
||
| 20 | } |
||
| 21 | |||
| 22 | foreach ($this->getRefProperties() as $refProp) { |
||
| 23 | $m3u8 = $this->getAnnotationReader()->getPropertyAnnotation($refProp, M3u8Interface::class); |
||
| 24 | if (null === $m3u8) { |
||
| 25 | continue; |
||
| 26 | } |
||
| 27 | |||
| 28 | $value = null === $this->getResult() ? null : $refProp->getValue($this->getResult()); |
||
| 29 | if (null !== $value && !is_array($value)) { |
||
| 30 | continue; |
||
| 31 | } |
||
| 32 | |||
| 33 | $parsed = $m3u8->setStream($this->getStream())->parse()->getResult(); |
||
| 34 | if (null !== $parsed) { |
||
| 35 | is_array($value) ? $value[] = $parsed : $value = $parsed; |
||
| 36 | $refProp->setValue($this->ensureResult(), $value); |
||
| 37 | |||
| 38 | break; |
||
| 39 | } |
||
| 40 | } |
||
| 41 | } while ($this->couldTryNextLine() && $this->moveToNextLine()); |
||
| 42 | |||
| 43 | return $this; |
||
| 44 | } |
||
| 45 | |||
| 111 |