Called when the root key is requested.
Sub-keys will be shared for further resolving, otherwise we will try for the manager/factory instance.

@param string $rootKey
@param string $key
@return mixed
@throws ResolverException
773192
public function resolve( $rootKey, $key = null )
	{
		if ( !$key )
		{
			if ( !is_null( $this->def ) )
				return $this->get( $this->def );

			throw new BindingException( "The default key was never set for Service Resolver [" . static::class . "]" );
		}

		if ( !is_string( $key ) )
			throw new ResolverException( "Key must be a string" );

		if ( $result = $this->get( $key ) )
			return $result;

		throw new ResolverException( "Failed to resolve [" . $rootKey . ( empty( $key ) ? "" : "." . $key ) . "]" );
	}
1195942
public function resolveRouteBinding($routeKey)
    {
        if (method_exists($this->wrappedObject, 'resolveRouteBinding') && is_callable([$this->wrappedObject, 'resolveRouteBinding'])) {
            return $this->wrappedObject->resolveRouteBinding($routeKey);
        }

        return $this->wrappedObject->where($this->wrappedObject->getRouteKeyName(), $routeKey)->first();
    }
764527
public function tryGet($key)
    {
        if (isset($this->overrides[$key])) {
            return $this->overrides[$key];
        }

        if (isset($this->defaults[$key])) {
            return $this->defaults[$key];
        }

        return null;
    }
832127
protected function load($key) {
        try {
            return $this->memcached->get($key);
        } catch (\Exception $e) {
            throw new StorageException("Failed to load memcached key: $key", 1, $e);
        }
    }
566982
protected function getResolver(string $key): ?ResolverInterface
    {
        foreach ($this->getResolvers() as $resolver) {
            if ($resolver->hasService($key) === true) {
                return $resolver;
            }
        }

        return null;
    }
1107864
public function acquire($key)
    {
        $filename = $this->getFilenameForMutexKey($key);
        for ($cycle = 1; ; ++$cycle) {
            $retry = false;
            // Let's cycle a few times to avoid concurrency problems
            try {
                if (isset($this->semaphores[$key]) && is_resource($this->semaphores[$key]) && is_file($filename)) {
                    $statBefore = @stat($filename);
                    $sem = $this->semaphores[$key];
                } else {
                    @touch($filename);
                    @chmod($filename, 0666);
                    $statBefore = @stat($filename);
                    $semKey = @ftok($filename, 'a');
                    if (!is_int($semKey) || $semKey === -1) {
                        $retry = true; // file may have been deleted in the meanwhile
                        throw new RuntimeException("ftok() failed for path {$filename}");
                    }
                    $errorDescription = '';
                    set_error_handler(function ($errno, $errstr) use (&$errorDescription) {
                        $errorDescription = (string) $errstr;
                    });
                    $sem = sem_get($semKey, 1);
                    restore_error_handler();
                    if ($sem === false) {
                        if (preg_match('/^sem_get\(\): failed for key 0x[A-Fa-f0-9]+: No space left on device$/', $errorDescription)) {
                            // In case we couldn't create the semaphore because the system reached the maximum number of semaphores,
                            // the system semget() function called by the sem_get() PHP function returns the ENOSPC error code.
                            // Its default description is
                            // "No space left on device"
                            // But it's really misleading.
                            // @see https://github.com/php/php-src/blob/php-7.3.1/ext/sysvsem/sysvsem.c#L216-L220
                            // @see http://man7.org/linux/man-pages/man2/semget.2.html#ERRORS
                            // @see https://www.gnu.org/software/libc/manual/html_node/Error-Codes.html#index-ENOSPC
                            throw new RuntimeException("The system ran out of semaphores.\nYou have to free some semaphores, or disable semaphore-based mutex.");
                        }
                        throw new RuntimeException("sem_get() failed for path {$filename}: {$errorDescription}");
                    }
                }
                if (@sem_acquire($sem, true) !== true) {
                    throw new MutexBusyException($key);
                }
                $statAfter = @stat($filename);
                if (!$statBefore || !$statAfter || $statBefore['ino'] !== $statBefore['ino']) {
                    @sem_release($sem);
                    $retry = true; // file may have been deleted and re-created in the meanwhile
                    throw new RuntimeException("sem_get() failed for path {$filename}");
                }
            } catch (RuntimeException $x) {
                if ($retry === true && $cycle < 5) {
                    continue;
                }
                throw $x;
            }
            break;
        }
        $this->semaphores[$key] = $sem;
    }
1214634
public function repeater(string $key)
    {
        $this->key($key);
        $this->group['repeater'] = true;

        return $this;
    }
1257275
protected function getRepository($key)
    {
        $rep = $this->entityRepositories[$key];
        if ($rep) {
            return $this->getEntityManager()->getRepository($rep);
        }
    }
420470
public function rel($key) {
		$rt = $this->fieldConf[$key]['relType'];
		$rc = $this->fieldConf[$key][$rt];
		if (!is_array($rc))
			$rc = array($rc,'_id');
		return $this->getRelInstance($rc[0],null,$key);
	}
920880
public function find($key)
    {
        $path = $this->finder->find($name);

        if ($path && !in_array($path, $this->paths)) {
            array_unshift($this->paths, $path);
        }

        return parent::find($name);
    }
673775
public function getKey($key)
	{
		return isset($this->data[$key]) ? $this->data[$key] : null;
	}
928616
private function prefixKey($key)
    {
        $first = explode('.', $key)[0];
        $isRootNode = in_array($first, $this->rootNodes, true);

        return $isRootNode ? 'config.'.$key : $key;
    }
161902
protected function resolveAlias($key)
	{
		if (isset($this->aliases[$key]))
		{
			return $this->aliases[$key];
		}

		return $key;
	}
959537
public function get(string $key): DataProviderInterface
    {
        $result = $this->getFactory()->getRedisClient()->get($key);

        if (!$result) {
            throw new RedisException('No value found for key ' . $key);
        }

        return $this->getFactory()->createConverter()->convertFrom(
            $result
        );
    }
1307480
public function release($key)
    {
        $key = (string) $key;
        if (isset($this->semaphores[$key])) {
            $sem = $this->semaphores[$key];
            unset($this->semaphores[$key]);
            if (is_resource($sem)) {
                @sem_release($sem);
            }
            $filename = $this->getFilenameForMutexKey($key);
            if (is_file($filename)) {
                @unlink($filename);
            }
        }
    }
193831
protected function loadPrivateKey($key)
    {
        if (app()->runningUnitTests()) {
            return '===FAKE-KEY===';
        }

        // If it's a relative path, start searching in the
        // project root
        if ($key[0] !== '/') {
            $key = base_path().'/'.$key;
        }

        return file_get_contents($key);
    }
1295270
public function resolve($key) {
        if (!array_key_exists($key, $this->bindings)) {
            throw new InvalidArgumentException("{$key} is not bound.");
        }

        $binding = $this->bindings[$key];
        $value = $binding['value'];

        // singleton
        if ($value instanceof Closure) {
            return $value($this);
        }

        // anonymous object
        if (is_null($value) && class_exists('\\' . $key)) {
            return $this->make($key);
        }

        // labeled object
        if (is_string($value) && class_exists('\\' . $value)) {
            return $this->make($value);
        }

        return $value;
    }