/** * Generate a list of files * * @param string $openApiSpec Location of the specification * @param string $namespace Namespace of the library * @param string $directory Path for the root directory of the generated files * * @return File[] */ public function generate($openApiSpec, $namespace, $directory) { /** @var OpenApi $openApi */ $context = $this->createContext($openApiSpec, 'Client', $namespace, $directory); $files = []; $files = array_merge($files, $this->modelGenerator->generate($context->getRootReference(), 'Client', $context)); $files = array_merge($files, $this->normalizerGenerator->generate($context->getRootReference(), 'Client', $context)); $clients = $this->clientGenerator->generate($context->getRootReference(), $namespace, $context); foreach ($clients as $node) { $files[] = new File($directory . DIRECTORY_SEPARATOR . 'Resource' . DIRECTORY_SEPARATOR . $node->stmts[2]->name . '.php', $node, ''); } return $files; }