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

        if (isset($data['body'])) {
            foreach ($data['body'] as $key => $bodyData) {
                $body = \in_array($key, \Raml\WebFormBody::$validMediaTypes, true) ? \Raml\WebFormBody::createFromArray($key, $bodyData) : \Raml\Body::createFromArray($key, $bodyData);

                $describedBy->addBody($body);
            }
        }

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

        if (isset($data['queryParameters'])) {
            foreach ($data['queryParameters'] as $key => $queryParameterData) {
                $describedBy->addQueryParameter(
                    NamedParameter::createFromArray($key, $queryParameterData)
                );
            }
        }

        if (isset($data['responses']) && \is_array($data['responses'])) {
            foreach ($data['responses'] as $responseCode => $response) {
                $describedBy->addResponse(
                    Response::createFromArray($responseCode, $response ?: [])
                );
            }
        }

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

        if (isset($data['body'])) {
            foreach ($data['body'] as $key => $bodyData) {
                $body = \in_array($key, \Raml\WebFormBody::$validMediaTypes, true) ? \Raml\WebFormBody::createFromArray($key, $bodyData) : \Raml\Body::createFromArray($key, $bodyData);

                $describedBy->addBody($body);
            }
        }

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

        if (isset($data['queryParameters'])) {
            foreach ($data['queryParameters'] as $key => $queryParameterData) {
                $describedBy->addQueryParameter(
                    NamedParameter::createFromArray($key, $queryParameterData)
                );
            }
        }

        if (isset($data['responses']) && \is_array($data['responses'])) {
            foreach ($data['responses'] as $responseCode => $response) {
                $describedBy->addResponse(
                    Response::createFromArray($responseCode, $response ?: [])
                );
            }
        }

        return $describedBy;
    }
public static function createFromArray ( $ key , array $ data = [ ] ) { $ describedBy = new static ( $ key ) ; if ( isset ( $ data [ 'body' ] ) ) { foreach ( $ data [ 'body' ] as $ key => $ bodyData ) { $ body = \ in_array ( $ key , \ Raml \ WebFormBody :: $ validMediaTypes , true ) ? \ Raml \ WebFormBody :: createFromArray ( $ key , $ bodyData ) : \ Raml \ Body :: createFromArray ( $ key , $ bodyData ) ; $ describedBy -> addBody ( $ body ) ; } } if ( isset ( $ data [ 'headers' ] ) ) { foreach ( $ data [ 'headers' ] as $ key => $ header ) { $ describedBy -> addHeader ( NamedParameter :: createFromArray ( $ key , $ header ) ) ; } } if ( isset ( $ data [ 'queryParameters' ] ) ) { foreach ( $ data [ 'queryParameters' ] as $ key => $ queryParameterData ) { $ describedBy -> addQueryParameter ( NamedParameter :: createFromArray ( $ key , $ queryParameterData ) ) ; } } if ( isset ( $ data [ 'responses' ] ) && \ is_array ( $ data [ 'responses' ] ) ) { foreach ( $ data [ 'responses' ] as $ responseCode => $ response ) { $ describedBy -> addResponse ( Response :: createFromArray ( $ responseCode , $ response ? : [ ] ) ) ; } } return $ describedBy ; }
Create a new SecuritySchemeDescribedBy from an array of data

@param string    $key
@param array     $data
[
headers:            ?array
queryParameters:    ?array
responses:          ?array
]

@return SecuritySchemeDescribedBy
Create a new SecuritySchemeDescribedBy from an array of data