library/Storage/Adapter/Cdn/Amazon/ClientAbstractFactory.php
public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        if ($serviceLocator instanceof ServiceLocatorAwareInterface) {
            $serviceLocator = $serviceLocator->getServiceLocator();
        }

        $config = $this->getConfig($serviceLocator);
        if (empty($config)) {
            return false;
        }

        return (
            isset($config[$requestedName])
            && is_array($config[$requestedName])
            && !empty($config[$requestedName])
            && isset($config[$requestedName]['region'])
            && is_string($config[$requestedName]['region'])
            && !empty($config[$requestedName]['region'])
            && isset($config[$requestedName]['secret'])
            && is_string($config[$requestedName]['secret'])
            && !empty($config[$requestedName]['secret'])
            && isset($config[$requestedName]['key'])
            && is_string($config[$requestedName]['key'])
            && !empty($config[$requestedName]['key'])
            && isset($config[$requestedName]['version'])
            && is_string($config[$requestedName]['version'])
            && !empty($config[$requestedName]['version'])
            && isset($config[$requestedName]['name'])
            && is_string($config[$requestedName]['name'])
            && !empty($config[$requestedName]['name'])
        );
    }
public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        if ($serviceLocator instanceof ServiceLocatorAwareInterface) {
            $serviceLocator = $serviceLocator->getServiceLocator();
        }

        $config = $this->getConfig($serviceLocator);
        if (empty($config)) {
            return false;
        }

        return (
            isset($config[$requestedName])
            && is_array($config[$requestedName])
            && !empty($config[$requestedName])
            && isset($config[$requestedName]['region'])
            && is_string($config[$requestedName]['region'])
            && !empty($config[$requestedName]['region'])
            && isset($config[$requestedName]['secret'])
            && is_string($config[$requestedName]['secret'])
            && !empty($config[$requestedName]['secret'])
            && isset($config[$requestedName]['key'])
            && is_string($config[$requestedName]['key'])
            && !empty($config[$requestedName]['key'])
            && isset($config[$requestedName]['version'])
            && is_string($config[$requestedName]['version'])
            && !empty($config[$requestedName]['version'])
            && isset($config[$requestedName]['name'])
            && is_string($config[$requestedName]['name'])
            && !empty($config[$requestedName]['name'])
        );
    }
Determine if we can create a service with name

@param ServiceLocatorInterface $serviceLocator
@param string $name
@param string $requestedName
@return boolean