Fragen\GitHub_Updater\Rest_Update::get_webhook_data PHP Метод

get_webhook_data() приватный Метод

If the request did not come from a webhook, this function returns false.
private get_webhook_data ( ) : boolean | array
Результат boolean | array false if no data; array of parsed webhook response
    private function get_webhook_data()
    {
        $request_body = file_get_contents('php://input');
        $request_data = json_decode($request_body, true);
        if (empty($request_data)) {
            return false;
        }
        // GitHub
        if ('push' == $_SERVER['HTTP_X_GITHUB_EVENT']) {
            return $this->parse_github_webhook($request_data);
        }
        // Bitbucket
        if ('repo:push' == $_SERVER['HTTP_X_EVENT_KEY']) {
            return $this->parse_bitbucket_webhook($request_data);
        }
        // GitLab
        if ('Push Hook' == $_SERVER['HTTP_X_GITLAB_EVENT']) {
            return $this->parse_gitlab_webhook($request_data);
        }
        return false;
    }