/** * Generate a list of files * * @param string $swaggerSpec 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($swaggerSpec, $namespace, $directory) { /** @var Swagger $swagger */ $context = $this->createContext($swaggerSpec, '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; }