ekinhbayar / gitamp

Listen to music generated by events across github.
MIT License
29 stars 10 forks source link

Results parser improvements #2

Closed PeeHaa closed 7 years ago

PeeHaa commented 7 years ago

https://github.com/ekinhbayar/gitamp/blob/master/src/Response/Results.php#L52-L54

Every event has an $action, $eventURL and a $message.

All these things end up being passed as strings to GithubEvent.

I think it would be nice to have a EventFactory which can build several events. So that each event in the above switch can have his own class. Including it's own parsing rules.

That way the entire switch and the filling of the events can be reduced to simply:

$events[] = $this->eventFactory->build($event);
PeeHaa commented 7 years ago

Done in https://github.com/ekinhbayar/gitamp/commit/97b3ba2691fb31a95f05a2e69e52bdfe5d326481