| Conditions | 6 |
| Paths | 5 |
| Total Lines | 33 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 9 | public function parse(string $line) |
||
| 10 | { |
||
| 11 | if ($this->isSkippable($line)) { |
||
| 12 | return false; // Return false to skip further process |
||
| 13 | } |
||
| 14 | |||
| 15 | if ($this->isFlagUpEventDelete() && self::isDataTootId($line)) { |
||
| 16 | $id_toot = self::extractDataFromString($line); |
||
| 17 | |||
| 18 | $this->resetFlags(); |
||
| 19 | $this->clearBuffer(); |
||
| 20 | |||
| 21 | $result = json_encode([ |
||
| 22 | 'event' => 'delete', |
||
| 23 | 'payload' => [ |
||
| 24 | 'id' => "${id_toot}" |
||
| 25 | ], |
||
| 26 | ]); |
||
| 27 | return $result; |
||
| 28 | } |
||
| 29 | |||
| 30 | if ($this->isFlagUpEventUpdate()) { |
||
| 31 | if (false !== $payload_array = $this->bufferPayloadUpdate($line)) { |
||
| 32 | $this->resetFlags(); |
||
| 33 | $this->clearBuffer(); |
||
| 34 | |||
| 35 | $result = json_encode([ |
||
| 36 | 'event' => 'update', |
||
| 37 | 'payload' => $payload_array |
||
| 38 | ]); |
||
| 39 | return $result; |
||
| 40 | } |
||
| 41 | } |
||
| 42 | |||
| 46 |