Laracasts\Behat\Context\Services\MailTrap::parseJson PHP Method

parseJson() protected method

protected parseJson ( $body ) : array | mixed
$body
return array | mixed
    protected function parseJson($body)
    {
        $data = json_decode((string) $body, true);
        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new RuntimeException('Unable to parse response body into JSON: ' . json_last_error());
        }
        return $data === null ? array() : $data;
    }