public static function createFromArray($statusCode, array $data = [])
    {
        $response = new static($statusCode);

        if (isset($data['body']) && \is_array($data['body'])) {
            foreach ($data['body'] as $key => $bodyData) {
                $response->addBody(Body::createFromArray($key, $bodyData ?: []));
            }
        }

        if (isset($data['description'])) {
            $response->setDescription($data['description']);
        }

        if (isset($data['headers'])) {
            foreach ($data['headers'] as $key => $header) {
                $response->addHeader(NamedParameter::createFromArray($key, $header));
            }
        }

        return $response;
    }
public static function createFromArray($statusCode, array $data = [])
    {
        $response = new static($statusCode);

        if (isset($data['body']) && \is_array($data['body'])) {
            foreach ($data['body'] as $key => $bodyData) {
                $response->addBody(Body::createFromArray($key, $bodyData ?: []));
            }
        }

        if (isset($data['description'])) {
            $response->setDescription($data['description']);
        }

        if (isset($data['headers'])) {
            foreach ($data['headers'] as $key => $header) {
                $response->addHeader(NamedParameter::createFromArray($key, $header));
            }
        }

        return $response;
    }
public static function createFromArray ( $ statusCode , array $ data = [ ] ) { $ response = new static ( $ statusCode ) ; if ( isset ( $ data [ 'body' ] ) && \ is_array ( $ data [ 'body' ] ) ) { foreach ( $ data [ 'body' ] as $ key => $ bodyData ) { $ response -> addBody ( Body :: createFromArray ( $ key , $ bodyData ? : [ ] ) ) ; } } if ( isset ( $ data [ 'description' ] ) ) { $ response -> setDescription ( $ data [ 'description' ] ) ; } if ( isset ( $ data [ 'headers' ] ) ) { foreach ( $ data [ 'headers' ] as $ key => $ header ) { $ response -> addHeader ( NamedParameter :: createFromArray ( $ key , $ header ) ) ; } } return $ response ; }
Create a new response object from an array

@param string $statusCode
@return Response
Create a new response object from an array