lib/GitHub/Event/Payload.php
public function parse(): Payload
    {
        /** Check signature from header */
        if (!$this->_checkSignature()) {
            throw new BadSignatureException('Hook secret does not match.');
        }

        /** Get data from different locations according to content-type */
        switch ($this->serverBag->get('CONTENT_TYPE')) {
            case 'application/json':
                $data = $this->getRawData();
                break;

            case 'application/x-www-form-urlencoded':
                $data = $_POST['payload'];
                break;

            default:
                throw new Exception('Unsupported content type: "' . $this->serverBag->get('CONTENT_TYPE') . '"');
        }
        $this->setParsedData($data);

        return $this;
    }
public function parse(): Payload
    {
        /** Check signature from header */
        if (!$this->_checkSignature()) {
            throw new BadSignatureException('Hook secret does not match.');
        }

        /** Get data from different locations according to content-type */
        switch ($this->serverBag->get('CONTENT_TYPE')) {
            case 'application/json':
                $data = $this->getRawData();
                break;

            case 'application/x-www-form-urlencoded':
                $data = $_POST['payload'];
                break;

            default:
                throw new Exception('Unsupported content type: "' . $this->serverBag->get('CONTENT_TYPE') . '"');
        }
        $this->setParsedData($data);

        return $this;
    }
public function parse ( ) : Payload { /** Check signature from header */ if ( ! $ this -> _checkSignature ( ) ) { throw new BadSignatureException ( 'Hook secret does not match.' ) ; } /** Get data from different locations according to content-type */ switch ( $ this -> serverBag -> get ( 'CONTENT_TYPE' ) ) { case 'application/json' : $ data = $ this -> getRawData ( ) ; break ; case 'application/x-www-form-urlencoded' : $ data = $ _POST [ 'payload' ] ; break ; default : throw new Exception ( 'Unsupported content type: "' . $ this -> serverBag -> get ( 'CONTENT_TYPE' ) . '"' ) ; } $ this -> setParsedData ( $ data ) ; return $ this ; }
Parse raw data

@return Payload
@throws BadSignatureException
@throws \Exception
Parse raw data