class ?? false) { $this->definition = $this->testFetcher->compile()[$context->class]; } } public function validate(FormContextInterface $context) : bool { if (isset($this->definition->attribute) && $this->definition->attribute->waitFor) { $this->waitFor = new $this->definition->attribute->waitFor(); } return $context->valid(); } public function execute(FormContextInterface $context) : mixed { if (isset($this->waitFor)) { $this->waitFor->run(); } $controller = $this->container->get($context->class); $test = $this->definition->methods->filtersOne(fn($e) => $e->attribute->name === $context->name); $request = $context->getRequest() ->withMethod($context->method) ->withAttribute('arguments', $test->attribute->arguments) ->withQueryParams($test->attribute->withQueryParams) ->withParsedBody($test->attribute->withParsedBody); $arguments = []; # @todo $result = $controller->{$test->name}($request, $arguments); return $result; } public function attributeCollection(array $collection) : EntityCollection { $collection = new EntityCollection(...$collection); $collection->entityClass = static::class; return $collection; } }