src/PeekAndPoke/Aviator/ServiceContainer/ServiceContainerCodeGenerator.php
private function generatePureCreatorMethod(ServiceDefinition $service) : string
    {
        $taggedAs        = implode(', ', $service->getTags());
        $classNormalized = $this->normalizeFqcn($service->getClass());

        ////  SINGLETON  ////////////////////////////////////////////////////////////////////////////////////////////

        if ($service->isSingleton()) {

            return <<<PHP
    /**
     * Get service {$service->getId()} (Singleton)
     *
     * It is tagged as: {$taggedAs}
     *
     * @return {$this->normalizeFqcn($service->getClass())}
     */
    public function {$this->mapIdToServiceGetter($service->getId())} () : $classNormalized {

        if (isset(\$this->singletons['{$service->getId()}'])) {
            return \$this->singletons['{$service->getId()}'];
        }

        /** @noinspection OneTimeUseVariablesInspection */
        \$service = \$this->singletons['{$service->getId()}'] = new $classNormalized(
{$this->buildInjectionParameters($this->container, $service->getInjection()->getCreatorInjection())}
        );

{$this->generateSetterInjectionsCode($service)}

        return \$service;
    }

PHP;
        }

        ////  PROTOTYPE  ////////////////////////////////////////////////////////////////////////////////////////////

        return <<<PHP
    /**
     * Get a fresh instance of service "{$service->getId()}" (Prototype)
     *
     * It is tagged as: {$taggedAs}
     *
     * @return {$this->normalizeFqcn($service->getClass())}
     */
    public function {$this->mapIdToServiceGetter($service->getId())} () : $classNormalized {

        \$this->prototypes['{$service->getId()}'] = (\$this->prototypes['{$service->getId()}'] ?? 0) + 1;

        /** @noinspection OneTimeUseVariablesInspection */
        \$service = new $classNormalized(
{$this->buildInjectionParameters($this->container, $service->getInjection()->getCreatorInjection())}
        );

{$this->generateSetterInjectionsCode($service)}

        return \$service;
    }

PHP;

    }
private function generatePureCreatorMethod(ServiceDefinition $service) : string
    {
        $taggedAs        = implode(', ', $service->getTags());
        $classNormalized = $this->normalizeFqcn($service->getClass());

        ////  SINGLETON  ////////////////////////////////////////////////////////////////////////////////////////////

        if ($service->isSingleton()) {

            return <<<PHP
    /**
     * Get service {$service->getId()} (Singleton)
     *
     * It is tagged as: {$taggedAs}
     *
     * @return {$this->normalizeFqcn($service->getClass())}
     */
    public function {$this->mapIdToServiceGetter($service->getId())} () : $classNormalized {

        if (isset(\$this->singletons['{$service->getId()}'])) {
            return \$this->singletons['{$service->getId()}'];
        }

        /** @noinspection OneTimeUseVariablesInspection */
        \$service = \$this->singletons['{$service->getId()}'] = new $classNormalized(
{$this->buildInjectionParameters($this->container, $service->getInjection()->getCreatorInjection())}
        );

{$this->generateSetterInjectionsCode($service)}

        return \$service;
    }

PHP;
        }

        ////  PROTOTYPE  ////////////////////////////////////////////////////////////////////////////////////////////

        return <<<PHP
    /**
     * Get a fresh instance of service "{$service->getId()}" (Prototype)
     *
     * It is tagged as: {$taggedAs}
     *
     * @return {$this->normalizeFqcn($service->getClass())}
     */
    public function {$this->mapIdToServiceGetter($service->getId())} () : $classNormalized {

        \$this->prototypes['{$service->getId()}'] = (\$this->prototypes['{$service->getId()}'] ?? 0) + 1;

        /** @noinspection OneTimeUseVariablesInspection */
        \$service = new $classNormalized(
{$this->buildInjectionParameters($this->container, $service->getInjection()->getCreatorInjection())}
        );

{$this->generateSetterInjectionsCode($service)}

        return \$service;
    }

PHP;

    }
Generates a creator method the instantiates a service with "new"

@param ServiceDefinition $service

@return string