Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SvnDriver.php

function SvnDriver::getComposerInformation

@inheritDoc

Overrides VcsDriver::getComposerInformation

File

vendor/composer/composer/src/Composer/Repository/Vcs/SvnDriver.php, line 136

Class

SvnDriver
@author Jordi Boggiano <j.boggiano@seld.be> @author Till Klampaeckel <till@php.net>

Namespace

Composer\Repository\Vcs

Code

public function getComposerInformation(string $identifier) : ?array {
    if (!isset($this->infoCache[$identifier])) {
        if ($this->shouldCache($identifier) && ($res = $this->cache
            ->read($identifier . '.json'))) {
            // old cache files had '' stored instead of null due to af3783b5f40bae32a23e353eaf0a00c9b8ce82e2, so we make sure here that we always return null or array
            // and fix outdated invalid cache files
            if ($res === '""') {
                $res = 'null';
                $this->cache
                    ->write($identifier . '.json', json_encode(null));
            }
            return $this->infoCache[$identifier] = JsonFile::parseJson($res);
        }
        try {
            $composer = $this->getBaseComposerInformation($identifier);
        } catch (TransportException $e) {
            $message = $e->getMessage();
            if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) {
                throw $e;
            }
            // remember a not-existent composer.json
            $composer = null;
        }
        if ($this->shouldCache($identifier)) {
            $this->cache
                ->write($identifier . '.json', json_encode($composer));
        }
        $this->infoCache[$identifier] = $composer;
    }
    // old cache files had '' stored instead of null due to af3783b5f40bae32a23e353eaf0a00c9b8ce82e2, so we make sure here that we always return null or array
    if (!is_array($this->infoCache[$identifier])) {
        return null;
    }
    return $this->infoCache[$identifier];
}
RSS feed
Powered by Drupal