src/ApiProblem.php
protected static function decompile(array $parsed) : self
    {
        $problem = new static();


        if (!empty($parsed['title'])) {
            $problem->setTitle($parsed['title']);
        }
        if (!empty($parsed['type'])) {
            $problem->setType($parsed['type']);
        }
        if (!empty($parsed['status'])) {
            $problem->setStatus((int) $parsed['status']);
        }
        if (!empty($parsed['detail'])) {
            $problem->setDetail($parsed['detail']);
        }
        if (!empty($parsed['instance'])) {
            $problem->setInstance($parsed['instance']);
        }

        // Remove the defined keys. That means whatever is left must be a custom
        // extension property.
        unset($parsed['title'], $parsed['type'], $parsed['status'], $parsed['detail'], $parsed['instance']);

        foreach ($parsed as $key => $value) {
            $problem[$key] = $value;
        }

        return $problem;
    }
protected static function decompile(array $parsed) : self
    {
        $problem = new static();


        if (!empty($parsed['title'])) {
            $problem->setTitle($parsed['title']);
        }
        if (!empty($parsed['type'])) {
            $problem->setType($parsed['type']);
        }
        if (!empty($parsed['status'])) {
            $problem->setStatus((int) $parsed['status']);
        }
        if (!empty($parsed['detail'])) {
            $problem->setDetail($parsed['detail']);
        }
        if (!empty($parsed['instance'])) {
            $problem->setInstance($parsed['instance']);
        }

        // Remove the defined keys. That means whatever is left must be a custom
        // extension property.
        unset($parsed['title'], $parsed['type'], $parsed['status'], $parsed['detail'], $parsed['instance']);

        foreach ($parsed as $key => $value) {
            $problem[$key] = $value;
        }

        return $problem;
    }
protected static function decompile ( array $ parsed ) : self { $ problem = new static ( ) ; if ( ! empty ( $ parsed [ 'title' ] ) ) { $ problem -> setTitle ( $ parsed [ 'title' ] ) ; } if ( ! empty ( $ parsed [ 'type' ] ) ) { $ problem -> setType ( $ parsed [ 'type' ] ) ; } if ( ! empty ( $ parsed [ 'status' ] ) ) { $ problem -> setStatus ( ( int ) $ parsed [ 'status' ] ) ; } if ( ! empty ( $ parsed [ 'detail' ] ) ) { $ problem -> setDetail ( $ parsed [ 'detail' ] ) ; } if ( ! empty ( $ parsed [ 'instance' ] ) ) { $ problem -> setInstance ( $ parsed [ 'instance' ] ) ; } // Remove the defined keys. That means whatever is left must be a custom // extension property. unset ( $ parsed [ 'title' ] , $ parsed [ 'type' ] , $ parsed [ 'status' ] , $ parsed [ 'detail' ] , $ parsed [ 'instance' ] ) ; foreach ( $ parsed as $ key => $ value ) { $ problem [ $ key ] = $ value ; } return $ problem ; }
Decompiles an array into an ApiProblem object.

@param array $parsed
An array parsed from JSON or XML to turn into an ApiProblem object.
@return ApiProblem
A new ApiProblem object.
Decompiles an array into an ApiProblem object .