/** * Handler the event * * @param MethodEvent $event */ public function __invoke(MethodEvent $event) { $methodModel = $event->getMethodModel(); $annotations = $event->getAnnotationCollection(); $methodBodyBuilder = $this->methodBodyBuilderFactory->make(); $handlers = [$this->handlerFactory->baseUrl($methodModel, $methodBodyBuilder, $annotations), $this->handlerFactory->serializationContext($methodModel, $methodBodyBuilder, $annotations), $this->handlerFactory->requestUrl($methodModel, $methodBodyBuilder, $annotations), $this->handlerFactory->requestHeader($methodModel, $methodBodyBuilder, $annotations), $this->handlerFactory->requestBody($methodModel, $methodBodyBuilder, $annotations), $this->handlerFactory->returns($methodModel, $methodBodyBuilder, $annotations)]; /** @var Handler $handler */ foreach ($handlers as $handler) { $handler->handle(); } $body = $methodBodyBuilder->build(); $methodModel->setBody($body); }
public function testCanCreateMethodBodyBuilder() { $factory = new MethodBodyBuilderFactory(); $builder = $factory->make(); $this->assertInstanceOf(MethodBodyBuilder::class, $builder); }