library/Service/ImageServiceAbstractFactory.php
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        $config = $this->getConfig($serviceLocator)[$requestedName];
        /* @var $service ImageServiceInterface */
        $service = new $this->serviceName();
        if (isset($config['type']) && is_string($config['type']) &&
            !empty($config['type']) && $serviceLocator->has($config['type'])
        ) {

            $service = $serviceLocator->get($config['type']);
        }
        // Storage
        /** @var $storage StorageInterface */
        $storage = $serviceLocator->get($config['storage']);
        /** @var $adapter CoreInterface */
        $adapter = null;
        /** @var $helperManager HelperPluginManager */
        $helperManager = null;
        // Adapter and pluginManager
        if (isset($config['helper_manager']) && isset($config['adapter'])) {
            $adapter = $serviceLocator->get($config['adapter']);
            $helperManager = $serviceLocator->get($config['helper_manager']);
            $helperManager->setAdapter($adapter);
        }

        if (isset($config['regex_identifier'])) {
            $service->setRegExIdentifier($config['regex_identifier']);
        }

        /* @var ImageServiceInterface $service */
        $service->setStorage($storage);
        if ($adapter) {
            $service->setAdapter($adapter);
        }
        if ($helperManager) {
            $service->setPluginManager($helperManager);
        }

        if (isset($config['renditions'])) {
            $service->setRenditions($config['renditions']);
        }

        return $service;
    }
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        $config = $this->getConfig($serviceLocator)[$requestedName];
        /* @var $service ImageServiceInterface */
        $service = new $this->serviceName();
        if (isset($config['type']) && is_string($config['type']) &&
            !empty($config['type']) && $serviceLocator->has($config['type'])
        ) {

            $service = $serviceLocator->get($config['type']);
        }
        // Storage
        /** @var $storage StorageInterface */
        $storage = $serviceLocator->get($config['storage']);
        /** @var $adapter CoreInterface */
        $adapter = null;
        /** @var $helperManager HelperPluginManager */
        $helperManager = null;
        // Adapter and pluginManager
        if (isset($config['helper_manager']) && isset($config['adapter'])) {
            $adapter = $serviceLocator->get($config['adapter']);
            $helperManager = $serviceLocator->get($config['helper_manager']);
            $helperManager->setAdapter($adapter);
        }

        if (isset($config['regex_identifier'])) {
            $service->setRegExIdentifier($config['regex_identifier']);
        }

        /* @var ImageServiceInterface $service */
        $service->setStorage($storage);
        if ($adapter) {
            $service->setAdapter($adapter);
        }
        if ($helperManager) {
            $service->setPluginManager($helperManager);
        }

        if (isset($config['renditions'])) {
            $service->setRenditions($config['renditions']);
        }

        return $service;
    }
Create service with name

@param ServiceLocatorInterface $serviceLocator
@param $name
@param $requestedName
@return StorageInterface