get the schema

@param OperationReference $service service endpoint

@return \stdClass
13285
private function getServiceSchema($service)
    {
        $operation = $service->getOperation();
        $schema = new \stdClass();
        switch (strtolower($service->getMethod())) {
            case "post":
            case "put":
                try {
                    $parameters = $operation->getDocumentObjectProperty('parameters', Parameter\Body::class, true);
                } catch (MissingDocumentPropertyException $e) {
                    // request has no params
                    break;
                }
                foreach ($parameters as $parameter) {
                    /**
                     * there is no schema information available, if $action->parameters[0]->in != 'body'
                     *
                     * @link http://swagger.io/specification/#parameterObject
                     */
                    if ($parameter instanceof Parameter\Body && $parameter->getIn() === 'body') {
                        $ref = $parameter->getDocumentObjectProperty('schema', Reference::class)->getDocument();
                        $schema = $this->resolveSchema($ref);
                        break;
                    }
                }
                break;
            case "get":
                try {
                    $response = $operation->getResponses()->getHttpStatusCode(200);
                } catch (MissingDocumentPropertyException $e) {
                    // no response with status code 200 is defined
                    break;
                }
                $schema = $this->resolveSchema($response->getSchema()->getDocument());
                break;
        }

        return $schema;
    }
1365060
private function getKernelContainerService(string $service): object
    {
        /** @var \Symfony\Component\DependencyInjection\ServiceLocator $serviceLocator */
        $serviceLocator = $this->container->get('service_bus.public_services_locator');

        /** @var object $object */
        $object = $serviceLocator->get($service);

        return $object;
    }
1165869
protected function resolveDatabaseServiceInstance($service = null)
    {
        /** @var EngineType $engine */
        $engine = $this->getEngineInstance();
        $services = $engine->getServiceInstanceByGroup('database');

        if (!isset($service) || !isset($services[$service])) {
            if (count($services) > 1) {
                $options = array_keys($services);
                $service = $this->doAsk(
                    new ChoiceQuestion(
                        'Select the database service to use for import: ',
                        $options
                    )
                );
            } else {
                $options = array_keys($services);
                $service = reset($options);
            }
        }

        if (!isset($services[$service])) {
            throw new \RuntimeException(
                'Unable to resolve database service.'
            );
        }

        return $services[$service];
    }
355600
public function getDataService(string $name, string $objectType, string $schema)
    {
        $services = $this->discovery->getDataServices();
        if (isset($services[$name][$objectType][$schema])) {
            return $services[$name][$objectType][$schema];
        }

        throw new \RuntimeException('Data service not found.');
    }
779536
public function grabService($service)
    {
        $container = $this->_getContainer();
        if (!$container->has($service)) {
            $this->fail("Service $service is not available in container");
        }
        return $container->get($service);
    }
910195
public function getServiceDatum($service, $key)
    {
        if (isset($this->servicesData[$service])) {
            return $this->servicesData[$service][$key];
        }

        return null;
    }
754606
public function getSchema($endpoint)
    {
        //remove base path
        if ('/' !== $this->basePath) {
            $endpoint = str_replace($this->basePath, '', $endpoint);
        }
        $retVal = new \stdClass();
        if (array_key_exists($endpoint, $this->schemes)) {
            $retVal = $this->schemes[$endpoint];
        }

        return $retVal;
    }
927382
protected function retrieveToken( $service ) {
        $tokenResponse = $this->client->attemptSoapResponse( 'sts', function() use ( $service ) {
            return $this->generateTokenRequest( $service );
        } );

        $securityDOM = new \DOMDocument();
        $securityDOM->loadXML( $tokenResponse );

        $newToken = new SecurityToken();

        $cipherValues = $securityDOM->getElementsByTagName( 'CipherValue' );
        $newToken->securityToken0 = $cipherValues->item( 0 )->textContent;
        $newToken->securityToken1 = $cipherValues->item( 1 )->textContent;

        $newToken->keyIdentifier = $securityDOM->getElementsByTagName( 'KeyIdentifier' )->item( 0 )->textContent;

        $newToken->binarySecret = $securityDOM->getElementsByTagName( 'BinarySecret' )->item( 0 )->textContent;

        if ( $securityDOM->getElementsByTagName( 'SecurityTokenReference' )->item( 0 )->prefix === 'wsse' ) {
            $securityDOM->getElementsByTagName( 'SecurityTokenReference' )->item( 0 )->setAttributeNS( 'http://www.w3.org/2000/xmlns/', 'xmlns:wsse', 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd' );
        }

        $newToken->securityToken = $securityDOM->saveXML( $securityDOM->getElementsByTagName( "RequestedSecurityToken" )->item( 0 )->firstChild );

        $expiryTime = $securityDOM->getElementsByTagName( "RequestSecurityTokenResponse" )->item( 0 )->getElementsByTagName( 'Expires' )->item( 0 )->textContent;
        $newToken->expiryTime = Client::parseTime( substr( $expiryTime, 0, -1 ), '%Y-%m-%dT%H:%M:%S' );

        $this->client->logger->info( 'Issued a new ' . $service . ' security token - expires at: ' . date( 'r', $newToken->expiryTime ) );

        return $newToken;
    }
1149349
public function getService($service = null)
    {
        if ( $service and ! array_key_exists($service, $this->service) )
        {
            $this->setService($service);
        }

        $this->setToken();

        return $this->service[$service];
    }
61906
public function getResponseSchema(string $path, string $method, int $code): Schema
    {
        return $this->getPath($path)->getOperation($method)->getResponse($code)->getSchema();
    }
968645
public function getScheme()
    {
        if ($this->_schema === null) {
            $this->_schema = $this->isSecureConnection() ? 'https' : 'http';
        }

        return $this->_schema;
    }
1050234
public function getOperation($operation)
    {
        $operationId = Utilities::getEntityId(
            $operation,
            'WindowsAzure\MediaServices\Models\Operation'
        );

        return Operation::createFromOptions($this->_getEntity("Operations('{$operationId}')"));
    }
1216951
public function generate (stdClass $service)
    {
        $this->createFileFromTemplate ([
            "destination"         => $service->rootDirectory . 'resources/lang/en/' . $service->translationFilePrefix . '.php',
            "templateDestination" => __DIR__ . '/../templates/service/translations.hctpl',
            "content"             => [
                "translations" => $this->gatherTranslations ($service),
            ],
        ]);

        return $service->rootDirectory . 'resources/lang/en/' . $service->translationFilePrefix . '.php';
    }
859032
public function getSchema($schemaId = null)
    {

        if (is_null($schemaId)) {
            $schemaId = $this->getCurrentlyUsedDatabaseId();
        }

        if (!$this->schemaExists(self::DATABASE_ID_DEFAULT)) {
            $this->createSchema(self::DATABASE_ID_DEFAULT);
        }

        $pattern = InternalDsn::PATTERN;
        if (!preg_match("/{$pattern}/is", $schemaId)) {
            throw new ErrorException("Invalid database-id '{$schemaId}' given! (Does not match pattern '{$pattern}')");
        }

        if (!isset($this->schemas[$schemaId])) {
            $schemaFilePath = sprintf(FilePathes::FILEPATH_SCHEMA, $schemaId);
            $schemaFile = $this->filesystem->getFile($schemaFilePath);
            $this->schemas[$schemaId] = new DatabaseSchema($schemaFile);
        }

        return $this->schemas[$schemaId];
    }
1138294
private function getSchema(): ?SchemaInterface
    {
        if ($this->schema !== null) {
            return $this->schema;
        }

        if (!empty($this->options['schema']) && $this->options['schema'] instanceof SchemaInterface) {
            $this->schema = $this->options['schema'];
            return $this->schema;
        }

        if (!empty($this->provider) && !empty($this->provider['class']) && !empty($this->provider['name'])) {

            //TODO this is a dirty way of receiving the service
            $provider = null;
            if ($this->serviceManager->has($this->provider['class'])) {
                $provider = $this->serviceManager->get($this->provider['class']);
            }

            if (empty($provider)) {
                foreach (\array_keys($this->serviceManager->getServiceManagerConfig()->getSubManagers()) as $subManager) {
                    if ($this->serviceManager->get($subManager)->has($this->provider['class'])) {
                        $provider = $this->serviceManager->get($subManager)->get($this->provider['class']);
                        break;
                    }
                }
            }

            if (!($provider instanceof SchemaProviderInterface)) {
                throw new \Exception("provider must implement " . SchemaProviderInterface::class);
            }

            $this->schema = $provider->provideSchema(
                $this->provider['name'],
                $this->builder,
                $this->provider['options']
            );
            return $this->schema;
        }

        throw new \Exception("Cant initialize without schema");
    }
1306511
public function schema($schema = null)
    {
        if (func_num_args() === 0) {
            return $this->collection->schema();
        }

        return $this->collection->schema($schema);
    }
189077
public function getSchema()
    {
        if ($this->_schema === null) {
            $this->_schema = $this->_initializeSchema($this->getWebservice()->describe($this->getName()));
        }

        return $this->_schema;
    }