protected function generateCreator(ContainerDefinition $container, ParameterInjection $inject, DiInjectHintAnnotation $settings) : string
    {
        // We apply some caching to speed up scanning through all services
        $serialized = serialize($settings);

        if (isset($this->creatorCache[$serialized])) {
            return $this->creatorCache[$serialized];
        }

        /** @var ServiceDefinition[] $filtered */
        $filtered = $container->filterByInjectHint($this->config, $settings);

        // Do we inject a list of services ?
        if ($inject->isList()) {

            $code = Psi::it($filtered)
                ->map(function (ServiceDefinition $definition) { return $this->generateCreatorByServiceId($definition->getId()); })
                ->join(', ');

            $result = "[$code]";
        } // no service found
        elseif (count($filtered) === 0) {
            $result = 'null';
        } else {
            $result = $this->generateCreatorByServiceId($filtered[0]->getId());
        }

        return $this->creatorCache[$serialized] = $result;
    }
protected function generateCreator(ContainerDefinition $container, ParameterInjection $inject, DiInjectHintAnnotation $settings) : string
    {
        // We apply some caching to speed up scanning through all services
        $serialized = serialize($settings);

        if (isset($this->creatorCache[$serialized])) {
            return $this->creatorCache[$serialized];
        }

        /** @var ServiceDefinition[] $filtered */
        $filtered = $container->filterByInjectHint($this->config, $settings);

        // Do we inject a list of services ?
        if ($inject->isList()) {

            $code = Psi::it($filtered)
                ->map(function (ServiceDefinition $definition) { return $this->generateCreatorByServiceId($definition->getId()); })
                ->join(', ');

            $result = "[$code]";
        } // no service found
        elseif (count($filtered) === 0) {
            $result = 'null';
        } else {
            $result = $this->generateCreatorByServiceId($filtered[0]->getId());
        }

        return $this->creatorCache[$serialized] = $result;
    }
@param ContainerDefinition    $container
@param ParameterInjection     $inject
@param DiInjectHintAnnotation $settings

@return string