public function getValidComposerInstallPaths($base_path = null)
    {
        $filepaths = [];

        /** @var ComposerConfig $composer */
        $composer = $this->getComposer();
        $composer_extra = $composer->getExtra();

        $base_path = isset($base_path) && file_exists($base_path)
            ? $base_path
            : ProjectX::projectRoot();

        $installed_paths = isset($composer_extra['installer-paths'])
            ? array_keys($composer_extra['installer-paths'])
            : [];

        $installed_directory = substr(static::getInstallPath(), strrpos(static::getInstallPath(), '/'));

        foreach ($installed_paths as $installed_path) {
            $path_info = pathinfo($installed_path);
            $directory = "/{$path_info['dirname']}";
            if (strpos($directory, $installed_directory) === false) {
                continue;
            }
            $filename = $path_info['filename'] !== '{$name}'
                ? "/{$path_info['filename']}"
                : null;
            $filepath = $base_path . $directory . $filename;

            if (!file_exists($filepath)) {
                continue;
            }

            $filepaths[] = $filepath;
        }

        return $filepaths;
    }