| Total Complexity | 6 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | trait HasParts |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Find all Parts of a message. |
||
| 11 | * Necessary to reset the $allParts Varibale. |
||
| 12 | * |
||
| 13 | * @param collection $partsContainer . F.e. collect([$message->payload]) |
||
| 14 | * |
||
| 15 | * @return Collection of all 'parts' flattened |
||
| 16 | */ |
||
| 17 | private function getAllParts($partsContainer) |
||
| 18 | { |
||
| 19 | return $this->iterateParts($partsContainer); |
||
|
|
|||
| 20 | } |
||
| 21 | |||
| 22 | |||
| 23 | /** |
||
| 24 | * Recursive Method. Iterates through a collection, |
||
| 25 | * finding all 'parts'. |
||
| 26 | * |
||
| 27 | * @param collection $partsContainer |
||
| 28 | * @param bool $returnOnFirstFound |
||
| 29 | * |
||
| 30 | * @return Collection|boolean |
||
| 31 | */ |
||
| 32 | |||
| 33 | private function iterateParts($partsContainer, $returnOnFirstFound = false) |
||
| 54 | } |
||
| 55 | } |
||
| 56 |