-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPingEvent.php
More file actions
79 lines (64 loc) · 1.76 KB
/
Copy pathPingEvent.php
File metadata and controls
79 lines (64 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
namespace Webhook\Payload;
use Webhook\Payload;
use Webhook\PayloadData\Hook;
use Webhook\PayloadData\PingRepository;
class PingEvent extends Payload {
/**
* @var string The random message generated for this ping event.
*/
public $zen;
/**
* @var int The ID of the webhook that triggered this ping event.
*/
public $hook_id;
/**
* @var \Webhook\PayloadData\Hook hook object
*/
public $hook;
/**
* @var \Webhook\PayloadData\PingRepository
*/
public $repository;
/**
* @var object
* @private
*/
private $input;
const EVENT_NAME = 'ping';
// /**
// * Populates a "generic" Payload <b>Event</b> object corresponding to this event.
// * @return \Webhook\Payload\Event
// */
// public function toEvent() : Event {
// $data = json_decode(json_encode($this));
// return new Event(json_decode(json_encode($this)),static::EVENT_NAME);
// }
/**
* Provides the event name.
* @return string
*/
public function getEvent(): string {
return static::EVENT_NAME;
}
/**
* @param object $input payload input
*/
public function __construct($input) {
$this->input = $input;
parent::__construct($input);
}
/**
* Indicates that the populating of this Payload object is complete.
* @return void
*/
public function populateComplete() {
parent::populateComplete();
if ((!$this->hook instanceof Hook) && is_object($this->hook)) {
$this->hook = (new Hook)->populateFromObject($this->hook);
}
if (!$this->repository instanceof PingRepository) {
$this->repository = (new PingRepository)->populateFromObject($this->repository);
}
}
}