protected function materializeResource(Resource $resource)
    {
        foreach ($resource as $method) {
            $request = $method->getRequest();
            if ($request) {
                $method->setRequest(new Schema($request->getDefinition()));
            }

            $responses = $method->getResponses();
            foreach ($responses as $statusCode => $response) {
                $method->addResponse($statusCode, new Schema($response->getDefinition()));
            }
        }
    }
protected function materializeResource(Resource $resource)
    {
        foreach ($resource as $method) {
            $request = $method->getRequest();
            if ($request) {
                $method->setRequest(new Schema($request->getDefinition()));
            }

            $responses = $method->getResponses();
            foreach ($responses as $statusCode => $response) {
                $method->addResponse($statusCode, new Schema($response->getDefinition()));
            }
        }
    }
protected function materializeResource ( Resource $ resource ) { foreach ( $ resource as $ method ) { $ request = $ method -> getRequest ( ) ; if ( $ request ) { $ method -> setRequest ( new Schema ( $ request -> getDefinition ( ) ) ) ; } $ responses = $ method -> getResponses ( ) ; foreach ( $ responses as $ statusCode => $ response ) { $ method -> addResponse ( $ statusCode , new Schema ( $ response -> getDefinition ( ) ) ) ; } } }
A resource can contain schema definitions which are only resolved if we
actual call the getDefinition method i.e. the schema is stored in a
database. So before we cache the documentation we must get the actual
definition object which we can serialize

@param \PSX\Api\Resource $resource
A resource can contain schema definitions which are only resolved if we actual call the getDefinition method i . e . the schema is stored in a database . So before we cache the documentation we must get the actual definition object which we can serialize