/** * Generate the complete operation class and save it to the filesystem. * @throws \ArtaxServiceBuilder\APIBuilderException */ function generate() { if ($this->namespace) { $fqcn = $this->namespace . '\\' . $this->className; } else { $fqcn = $this->className; } $this->addProperties(); $this->addConstructorMethod(); $this->addSetAPIMethod(); $this->addSetParameterMethod(); $this->addCheckScopeMethod(); $this->addAccessorMethods(); $this->addFilteredParameterMethod(); $this->addCreateRequestMethod(); $this->addCreateAndExecuteMethod(); $this->addCallMethod(); $this->addExecuteMethod(); $this->addExecuteAsyncMethod(); $this->addDispatchMethod(); $this->addDispatchAsyncMethod(); $this->addProcessResponseMethod(); //$this->addIsErrorResponseMethod(); $this->addShouldResponseBeProcessedMethod(); $this->addTranslateResponseToExceptionMethod(); $this->addShouldUseCachedResponseMethod(); $this->addShouldResponseBeCachedMethod(); $this->addSetOriginalResponseMethod(); $this->addGetOriginalResponseMethod(); $this->addGetResultInstantiationInfoMethod(); $this->classGenerator->setImplementedInterfaces(['ArtaxServiceBuilder\\Operation']); $this->classGenerator->setFQCN($fqcn); $text = $this->classGenerator->generate(); saveFile($this->outputPath, $fqcn, $text); }
/** * @param $fqcn */ function setFQCN($fqcn) { $this->fqcn = $fqcn; $this->classGenerator->setFQCN($fqcn); if ($this->fqExceptionClassname == null) { $this->fqExceptionClassname = $this->fqcn . 'Exception'; } $this->namespace = \ArtaxServiceBuilder\getNamespace($this->fqcn); }