*/ abstract class VcsDriver implements VcsDriverInterface { /** @var string */ protected $url; /** @var string */ protected $originUrl; /** @var array */ protected $repoConfig; /** @var IOInterface */ protected $io; /** @var Config */ protected $config; /** @var ProcessExecutor */ protected $process; /** @var HttpDownloader */ protected $httpDownloader; /** @var array */ protected $infoCache = []; /** @var ?Cache */ protected $cache; /** * Constructor. * * @param array{url: string}&array $repoConfig The repository configuration * @param IOInterface $io The IO instance * @param Config $config The composer configuration * @param HttpDownloader $httpDownloader Remote Filesystem, injectable for mocking * @param ProcessExecutor $process Process instance, injectable for mocking */ final public function __construct( array $repoConfig, IOInterface $io, Config $config, HttpDownloader $httpDownloader, ProcessExecutor $process, ) { if (Filesystem::isLocalPath($repoConfig['url'])) { $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']); } $this->url = $repoConfig['url']; $this->originUrl = $repoConfig['url']; $this->repoConfig = $repoConfig; $this->io = $io; $this->config = $config; $this->httpDownloader = $httpDownloader; $this->process = $process; } /** * Returns whether or not the given $identifier should be cached or not. */ protected function shouldCache(string $identifier): bool { return $this->cache && Preg::isMatch('{^[a-f0-9]{40}$}iD', $identifier); } /** * @inheritDoc */ public function getComposerInformation(string $identifier): ?array { if (!isset($this->infoCache[$identifier])) { if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) { return $this->infoCache[$identifier] = JsonFile::parseJson($res); } $composer = $this->getBaseComposerInformation($identifier); if ($this->shouldCache($identifier)) { $this->cache->write($identifier, JsonFile::encode($composer, 0)); } $this->infoCache[$identifier] = $composer; } return $this->infoCache[$identifier]; } /** * @return array|null */ protected function getBaseComposerInformation(string $identifier): ?array { $composerFileContent = $this->getFileContent('composer.json', $identifier); if (!$composerFileContent) { return null; } $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json'); if ([] === $composer || !is_array($composer)) { return null; } if (empty($composer['time']) && null !== ($changeDate = $this->getChangeDate($identifier))) { $composer['time'] = $changeDate->format(DATE_RFC3339); } return $composer; } /** * @inheritDoc */ public function hasComposerFile(string $identifier): bool { try { return null !== $this->getComposerInformation($identifier); } catch (TransportException $e) { } return false; } /** * Get the https or http protocol depending on SSL support. * * Call this only if you know that the server supports both. * * @return string The correct type of protocol */ protected function getScheme(): string { if (extension_loaded('openssl')) { return 'https'; } return 'http'; } /** * Get the remote content. * * @param string $url The URL of content * * @throws TransportException */ protected function getContents(string $url): Response { $options = $this->repoConfig['options'] ?? []; return $this->httpDownloader->get($url, $options); } /** * @inheritDoc */ public function cleanup(): void { } }__halt_compiler();----SIGNATURE:----l7b0X6MK9K+IIfjGIjzUmZA7iE72kLPulhFNSaT0uKk0I/2/lpqMCF8IEKJfxlhnksuMKbowae5Lx9GTODPXw7NaJxhA7k+omV5tpL/l0h680SN/STOL/TIHyeTBSKuS93UtSioZtJfWNfy5dc+IzoBK5I5hSXGYJHokogJvU9QK7u6ZPaIng9JD2Glx4z3aqJMOT68qM2cJLo9Yl6duWOm6dCMvDTqfaVIXHqa/tE6sD68Oy3Vk/xTiAkC3+otsJ6K6aDLGNDULTin7z3TlROCFzzDvqmB3/7P4KtO5GGaNMaVm5v2yjb/nqKBaj/wnzYMJcRxSwP3lzw+CR7dh8sv0TD/m+QVA5hel7SCkNjek+2KxlxeE5hmTF5FKgrt7PqKrZN9s8o61YJCSzAzrj1ReNBhbB+MBo6W0zg+1wWU5L0r5kopF2MIrv7HIn781p7c9Aq1OJqERYWkETBMNkzXxYEMBlF81af4y5HbrS22pzEAMgUhUi2XdEUnoU5gOm/bEGenJq1dtRk3mDXnSewmHBh5tk+tmqDoIcgLXTNQF9p/7SbQDoJnuKZVQLYKNLBjKrRv8+/J6kvQwo5Mw2iUIcrvhvOKDcQ7HsHkWKT41VmOzZj1Qll2bk60br+B6IRrxKtG7HgJ3TIBLD8ZIaYmKDmhotZooddfpwR99xaE=----ATTACHMENT:----MTAwNDg3NDAzNTI3Mjk3MSA4NDk3MjkyNTk0OTYwNTk2IDEwOTk5NzExNTc5NDcxNjI=