ekinhbayar / gitamp

Listen to music generated by events across github.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Results parser improvements

PeeHaa opened this issue · comments

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);