protected function getManifestContents(string $manifest, ?array $lockContent): array
    {
        $path = $sourcePath = $this->guessExtensionPath($manifest);
        $jsonable = \json_decode($this->files->get($manifest), true);

        // If json_decode fail, due to invalid json format. We going to
        // throw an exception so this error can be fixed by the developer
        // instead of allowing the application to run with a buggy config.
        if (\is_null($jsonable)) {
            throw new ManifestRuntimeException("Cannot decode file [{$manifest}]");
        }

        if (\is_array($lockContent)) {
            foreach (['description', 'version'] as $type) {
                $jsonable[$type] = $lockContent[$type] ?? $jsonable[$type] ?? null;
            }
        }

        $path = $jsonable['path'] ?? $path;

        $paths = [
            'path' => \rtrim($path, '/'),
            'source-path' => \rtrim($sourcePath, '/'),
        ];

        // Generate a proper manifest configuration for the extension. This
        // would allow other part of the application to use this configuration
        // to migrate, load service provider as well as preload some
        // configuration.
        return \array_merge($paths, $this->generateManifestConfig($jsonable));
    }