src/Event/GitHubEventFactory.php
public function buildFromRequest(RequestInterface $request)
    {
        $eventType = $request->getHeader('X-GitHub-Event');

        if (count($eventType) > 0) {
            $eventType = current($eventType);
        } else {
            throw new MissingGitHubEventTypeException($request);
        }

        $body = $request->getBody();
        $body->rewind();
        $body = $body->getContents();

        $payload = json_decode($body, true);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new InvalidGitHubRequestPayloadException($request, $body);
        }

        return $this->build($eventType, $payload);
    }
public function buildFromRequest(RequestInterface $request)
    {
        $eventType = $request->getHeader('X-GitHub-Event');

        if (count($eventType) > 0) {
            $eventType = current($eventType);
        } else {
            throw new MissingGitHubEventTypeException($request);
        }

        $body = $request->getBody();
        $body->rewind();
        $body = $body->getContents();

        $payload = json_decode($body, true);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new InvalidGitHubRequestPayloadException($request, $body);
        }

        return $this->build($eventType, $payload);
    }
public function buildFromRequest ( RequestInterface $ request ) { $ eventType = $ request -> getHeader ( 'X-GitHub-Event' ) ; if ( count ( $ eventType ) > 0 ) { $ eventType = current ( $ eventType ) ; } else { throw new MissingGitHubEventTypeException ( $ request ) ; } $ body = $ request -> getBody ( ) ; $ body -> rewind ( ) ; $ body = $ body -> getContents ( ) ; $ payload = json_decode ( $ body , true ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { throw new InvalidGitHubRequestPayloadException ( $ request , $ body ) ; } return $ this -> build ( $ eventType , $ payload ) ; }
{@inheritdoc}
{