private function applyTransformersToResult(Result $result): Result
    {
        return empty($result->getSubresults())
            ? Result::create(
                $result->getQueryUUID(),
                $result->getTotalItems(),
                $result->getTotalHits(),
                $result->getAggregations(),
                $result->getSuggests(),
                $this
                    ->transformer
                    ->fromItems(
                        $result->getItems()
                    )
            )
            : Result::createMultiResult(
                array_map(function (Result $subresult) {
                    return $this->applyTransformersToResult($subresult);
                }, $result->getSubresults())
            );
    }
private function applyTransformersToResult(Result $result): Result
    {
        return empty($result->getSubresults())
            ? Result::create(
                $result->getQueryUUID(),
                $result->getTotalItems(),
                $result->getTotalHits(),
                $result->getAggregations(),
                $result->getSuggests(),
                $this
                    ->transformer
                    ->fromItems(
                        $result->getItems()
                    )
            )
            : Result::createMultiResult(
                array_map(function (Result $subresult) {
                    return $this->applyTransformersToResult($subresult);
                }, $result->getSubresults())
            );
    }
private function applyTransformersToResult ( Result $ result ) : Result { return empty ( $ result -> getSubresults ( ) ) ? Result :: create ( $ result -> getQueryUUID ( ) , $ result -> getTotalItems ( ) , $ result -> getTotalHits ( ) , $ result -> getAggregations ( ) , $ result -> getSuggests ( ) , $ this -> transformer -> fromItems ( $ result -> getItems ( ) ) ) : Result :: createMultiResult ( array_map ( function ( Result $ subresult ) { return $ this -> applyTransformersToResult ( $ subresult ) ; } , $ result -> getSubresults ( ) ) ) ; }
Apply transformers on Result.

@param Result $result

@return Result
Apply transformers on Result .