/** * 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); }
/** * */ function generate() { $this->classGenerator->addUse('Amp\\Artax\\Request'); $this->classGenerator->addUse('Amp\\Artax\\Response'); $this->classGenerator->addUse('Amp\\Reactor'); $this->sanityCheck(); $this->addProperties([]); $this->addConstructorMethod(); $this->addSignMethod(); $this->generateMethods(); $this->addAPIParameterAccessMethod(); if (count($this->interfaces)) { $this->classGenerator->setImplementedInterfaces($this->interfaces); } $this->classGenerator->addUse('ArtaxServiceBuilder\\ResponseCache'); $this->classGenerator->setAbstract(true); $this->generateExceptionClass(); $this->addExecMethod(); $this->addExecAsyncMethod(); $this->addShouldResponseBeProcessedMethod(); $this->addShouldResponseBeCachedMethod(); $this->addShouldUseCachedResponseMethod(); $this->addAbstractInstantiateResultMethod(); //$this->addIsErrorResponseMethod(); $this->addtranslateResponseToExceptionMethod(); $text = $this->classGenerator->generate(); saveFile($this->outputPath, $this->fqcn, $text); }