1 | <?php |
||
10 | class Writing_On_GitHub_Request { |
||
11 | |||
12 | /** |
||
13 | * Application container. |
||
14 | * |
||
15 | * @var Writing_On_GitHub |
||
16 | */ |
||
17 | protected $app; |
||
18 | |||
19 | /** |
||
20 | * Raw request data. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $raw_data; |
||
25 | |||
26 | /** |
||
27 | * Headers |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $headers; |
||
31 | |||
32 | /** |
||
33 | * Writing_On_GitHub_Request constructor. |
||
34 | * |
||
35 | * @param Writing_On_GitHub $app Application container. |
||
36 | */ |
||
37 | public function __construct( Writing_On_GitHub $app ) { |
||
40 | |||
41 | /** |
||
42 | * Validates the header's secret. |
||
43 | * |
||
44 | * @return true|WP_Error |
||
|
|||
45 | */ |
||
46 | public function is_secret_valid() { |
||
64 | |||
65 | /** |
||
66 | * Validates the ping event. |
||
67 | * @return boolean |
||
68 | */ |
||
69 | public function is_ping() { |
||
72 | |||
73 | /** |
||
74 | * Validates the push event. |
||
75 | * @return boolean |
||
76 | */ |
||
77 | public function is_push() { |
||
80 | |||
81 | /** |
||
82 | * Return X-Github-Event in headers. |
||
83 | * @return string |
||
84 | */ |
||
85 | public function webhook_event() { |
||
89 | |||
90 | /** |
||
91 | * Returns a payload object for the given request. |
||
92 | * |
||
93 | * @return Writing_On_GitHub_Payload |
||
94 | */ |
||
95 | public function payload() { |
||
98 | |||
99 | /** |
||
100 | * Cross-server header support. |
||
101 | * |
||
102 | * Returns an array of the request's headers. |
||
103 | * |
||
104 | * @return array |
||
105 | */ |
||
106 | protected function headers() { |
||
129 | |||
130 | /** |
||
131 | * Reads the raw data from STDIN. |
||
132 | * |
||
133 | * @return string |
||
134 | */ |
||
135 | protected function read_raw_data() { |
||
138 | |||
139 | /** |
||
140 | * Returns the Webhook secret |
||
141 | * |
||
142 | * @return string |
||
143 | */ |
||
144 | protected function secret() { |
||
147 | } |
||
148 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.