src/Graviton/ProxyBundle/Definition/Loader/DispersalStrategy/SwaggerStrategy.php
public function supports($input)
    {
        /**
         * @var array $swagger
         */
        $swagger = $this->decodeJson($input, true);

        if (empty($swagger)) {
            return false;
        }

        $mandatoryFields = ['swagger', 'info', 'paths', 'version', 'title', 'definitions'];
        $fields = array_merge(array_keys($swagger), array_keys($swagger['info']));
        $intersect = array_intersect($mandatoryFields, $fields);

        // every mandatory field was found in provided json definition.
        return empty(array_diff($mandatoryFields, $intersect));
    }
public function supports($input)
    {
        /**
         * @var array $swagger
         */
        $swagger = $this->decodeJson($input, true);

        if (empty($swagger)) {
            return false;
        }

        $mandatoryFields = ['swagger', 'info', 'paths', 'version', 'title', 'definitions'];
        $fields = array_merge(array_keys($swagger), array_keys($swagger['info']));
        $intersect = array_intersect($mandatoryFields, $fields);

        // every mandatory field was found in provided json definition.
        return empty(array_diff($mandatoryFields, $intersect));
    }
public function supports ( $ input ) { /**
         * @var array $swagger
         */ $ swagger = $ this -> decodeJson ( $ input , true ) ; if ( empty ( $ swagger ) ) { return false ; } $ mandatoryFields = [ 'swagger' , 'info' , 'paths' , 'version' , 'title' , 'definitions' ] ; $ fields = array_merge ( array_keys ( $ swagger ) , array_keys ( $ swagger [ 'info' ] ) ) ; $ intersect = array_intersect ( $ mandatoryFields , $ fields ) ; // every mandatory field was found in provided json definition. return empty ( array_diff ( $ mandatoryFields , $ intersect ) ) ; }
is input data valid json

@param string $input json string

@return boolean
is input data valid json