| @@ 13-49 (lines=37) @@ | ||
| 10 | use ekinhbayar\GitAmp\Presentation\Sound\Swell; |
|
| 11 | use ekinhbayar\GitAmp\Presentation\Sound\SwellEgg; |
|
| 12 | ||
| 13 | class ForkEvent extends BaseEvent |
|
| 14 | { |
|
| 15 | public function __construct(array $event) |
|
| 16 | { |
|
| 17 | parent::__construct( |
|
| 18 | (int) $event['id'], |
|
| 19 | new Type(5), |
|
| 20 | new Information($this->buildUrl($event), $this->buildPayload(), $this->buildMessage($event)), |
|
| 21 | new Ring(3000, 80), |
|
| 22 | $this->buildSound($event) |
|
| 23 | ); |
|
| 24 | } |
|
| 25 | ||
| 26 | private function buildUrl(array $event): string |
|
| 27 | { |
|
| 28 | return 'https://github.com/' . $event['repo']['name']; |
|
| 29 | } |
|
| 30 | ||
| 31 | private function buildPayload(): string |
|
| 32 | { |
|
| 33 | return 'not sure if stupid but works anyway'; |
|
| 34 | } |
|
| 35 | ||
| 36 | private function buildMessage(array $event): string |
|
| 37 | { |
|
| 38 | return \sprintf('%s forked %s', $event['actor']['login'], $event['repo']['name']); |
|
| 39 | } |
|
| 40 | ||
| 41 | private function buildSound(array $event): BaseSound |
|
| 42 | { |
|
| 43 | if ($event['repo']['name'] === 'ekinhbayar/gitamp') { |
|
| 44 | return new SwellEgg(); |
|
| 45 | } |
|
| 46 | ||
| 47 | return new Swell(); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| @@ 13-49 (lines=37) @@ | ||
| 10 | use ekinhbayar\GitAmp\Presentation\Sound\Swell; |
|
| 11 | use ekinhbayar\GitAmp\Presentation\Sound\SwellEgg; |
|
| 12 | ||
| 13 | class WatchEvent extends BaseEvent |
|
| 14 | { |
|
| 15 | public function __construct(array $event) |
|
| 16 | { |
|
| 17 | parent::__construct( |
|
| 18 | (int) $event['id'], |
|
| 19 | new Type(7), |
|
| 20 | new Information($this->buildUrl($event), $this->buildPayload(), $this->buildMessage($event)), |
|
| 21 | new Ring(3000, 80), |
|
| 22 | $this->buildSound($event) |
|
| 23 | ); |
|
| 24 | } |
|
| 25 | ||
| 26 | private function buildUrl(array $event): string |
|
| 27 | { |
|
| 28 | return 'https://github.com/' . $event['repo']['name']; |
|
| 29 | } |
|
| 30 | ||
| 31 | private function buildPayload(): string |
|
| 32 | { |
|
| 33 | return 'not sure if stupid but works anyway'; |
|
| 34 | } |
|
| 35 | ||
| 36 | private function buildMessage(array $event): string |
|
| 37 | { |
|
| 38 | return \sprintf('%s watched %s', $event['actor']['login'], $event['repo']['name']); |
|
| 39 | } |
|
| 40 | ||
| 41 | private function buildSound(array $event): BaseSound |
|
| 42 | { |
|
| 43 | if ($event['repo']['name'] === 'ekinhbayar/gitamp') { |
|
| 44 | return new SwellEgg(); |
|
| 45 | } |
|
| 46 | ||
| 47 | return new Swell(); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||