private function loadDefinition($version, $resource, $type, $key = null) : string
    {
        $definition = $this->definition($resource, $version);

        $classPath = $definition->$type;
        if (is_array($classPath) && array_key_exists($key, $classPath)) {
            $classPath = $classPath[$key];
        }

        if ($classPath === null) {
            throw ResourceNotDefinedException::resource($resource, $type);
        }

        return $classPath;
    }