public static function create(array $options = [])
    {
        $config = new static();

        if (! empty($options)) {
            if (isset($options['query'])) {
                $config->setQuery($options['query']);
            }

            if (isset($options['mutation'])) {
                $config->setMutation($options['mutation']);
            }

            if (isset($options['subscription'])) {
                $config->setSubscription($options['subscription']);
            }

            if (isset($options['types'])) {
                $config->setTypes($options['types']);
            }

            if (isset($options['directives'])) {
                $config->setDirectives($options['directives']);
            }

            if (isset($options['typeLoader'])) {
                Utils::invariant(
                    is_callable($options['typeLoader']),
                    'Schema type loader must be callable if provided but got: %s',
                    Utils::printSafe($options['typeLoader'])
                );
                $config->setTypeLoader($options['typeLoader']);
            }

            if (isset($options['astNode'])) {
                $config->setAstNode($options['astNode']);
            }

            if (isset($options['assumeValid'])) {
                $config->setAssumeValid((bool) $options['assumeValid']);
            }

            if (isset($options['extensionASTNodes'])) {
                $config->setExtensionASTNodes($options['extensionASTNodes']);
            }
        }

        return $config;
    }
public static function create(array $options = [])
    {
        $config = new static();

        if (! empty($options)) {
            if (isset($options['query'])) {
                $config->setQuery($options['query']);
            }

            if (isset($options['mutation'])) {
                $config->setMutation($options['mutation']);
            }

            if (isset($options['subscription'])) {
                $config->setSubscription($options['subscription']);
            }

            if (isset($options['types'])) {
                $config->setTypes($options['types']);
            }

            if (isset($options['directives'])) {
                $config->setDirectives($options['directives']);
            }

            if (isset($options['typeLoader'])) {
                Utils::invariant(
                    is_callable($options['typeLoader']),
                    'Schema type loader must be callable if provided but got: %s',
                    Utils::printSafe($options['typeLoader'])
                );
                $config->setTypeLoader($options['typeLoader']);
            }

            if (isset($options['astNode'])) {
                $config->setAstNode($options['astNode']);
            }

            if (isset($options['assumeValid'])) {
                $config->setAssumeValid((bool) $options['assumeValid']);
            }

            if (isset($options['extensionASTNodes'])) {
                $config->setExtensionASTNodes($options['extensionASTNodes']);
            }
        }

        return $config;
    }
public static function create ( array $ options = [ ] ) { $ config = new static ( ) ; if ( ! empty ( $ options ) ) { if ( isset ( $ options [ 'query' ] ) ) { $ config -> setQuery ( $ options [ 'query' ] ) ; } if ( isset ( $ options [ 'mutation' ] ) ) { $ config -> setMutation ( $ options [ 'mutation' ] ) ; } if ( isset ( $ options [ 'subscription' ] ) ) { $ config -> setSubscription ( $ options [ 'subscription' ] ) ; } if ( isset ( $ options [ 'types' ] ) ) { $ config -> setTypes ( $ options [ 'types' ] ) ; } if ( isset ( $ options [ 'directives' ] ) ) { $ config -> setDirectives ( $ options [ 'directives' ] ) ; } if ( isset ( $ options [ 'typeLoader' ] ) ) { Utils :: invariant ( is_callable ( $ options [ 'typeLoader' ] ) , 'Schema type loader must be callable if provided but got: %s' , Utils :: printSafe ( $ options [ 'typeLoader' ] ) ) ; $ config -> setTypeLoader ( $ options [ 'typeLoader' ] ) ; } if ( isset ( $ options [ 'astNode' ] ) ) { $ config -> setAstNode ( $ options [ 'astNode' ] ) ; } if ( isset ( $ options [ 'assumeValid' ] ) ) { $ config -> setAssumeValid ( ( bool ) $ options [ 'assumeValid' ] ) ; } if ( isset ( $ options [ 'extensionASTNodes' ] ) ) { $ config -> setExtensionASTNodes ( $ options [ 'extensionASTNodes' ] ) ; } } return $ config ; }
Converts an array of options to instance of SchemaConfig
(or just returns empty config when array is not passed).

@param mixed[] $options

@return SchemaConfig

@api
Converts an array of options to instance of SchemaConfig ( or just returns empty config when array is not passed ) .