private function findServiceClassName($services, $serviceName)
    {
        $candidates = array_filter(array_keys($services), function ($service) use ($serviceName) {
            $service = str_replace(array('/', '*', '-'), array('\\/', '.*', '\\-'), $service);
            return preg_match('/^' . $service . '$/', $serviceName);
        });
        if (count($candidates) > 0) {
            $prefix = preg_replace('/\*$/', '', current($candidates));
            $info = $services[current($candidates)];
            if (strpos($info, 'file:') === 0) {
                $appFile = $this->environment->getBootstrap()->getAppRoot() . '/' . str_replace('file:', '', $info);
                $config = json_decode(file_get_contents($appFile), true);
                return $this->findServiceClassName($config['services'], str_replace($prefix, '', $serviceName));
            } else {
                return $info;
            }
        }
        throw new \Exception("Unknown service: '{$serviceName}'");
    }