*/ class PerforceDriver extends VcsDriver { /** @var string */ protected $depot; /** @var string */ protected $branch; /** @var ?Perforce */ protected $perforce = null; /** * @inheritDoc */ public function initialize(): void { $this->depot = $this->repoConfig['depot']; $this->branch = ''; if (!empty($this->repoConfig['branch'])) { $this->branch = $this->repoConfig['branch']; } $this->initPerforce($this->repoConfig); $this->perforce->p4Login(); $this->perforce->checkStream(); $this->perforce->writeP4ClientSpec(); $this->perforce->connectClient(); } /** * @param array $repoConfig */ private function initPerforce(array $repoConfig): void { if (!empty($this->perforce)) { return; } if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) { throw new \RuntimeException('PerforceDriver requires a usable cache directory, and it looks like you set it to be disabled'); } $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot; $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io); } /** * @inheritDoc */ public function getFileContent(string $file, string $identifier): ?string { return $this->perforce->getFileContent($file, $identifier); } /** * @inheritDoc */ public function getChangeDate(string $identifier): ?\DateTimeImmutable { return null; } /** * @inheritDoc */ public function getRootIdentifier(): string { return $this->branch; } /** * @inheritDoc */ public function getBranches(): array { return $this->perforce->getBranches(); } /** * @inheritDoc */ public function getTags(): array { return $this->perforce->getTags(); } /** * @inheritDoc */ public function getDist(string $identifier): ?array { return null; } /** * @inheritDoc */ public function getSource(string $identifier): array { return [ 'type' => 'perforce', 'url' => $this->repoConfig['url'], 'reference' => $identifier, 'p4user' => $this->perforce->getUser(), ]; } /** * @inheritDoc */ public function getUrl(): string { return $this->url; } /** * @inheritDoc */ public function hasComposerFile(string $identifier): bool { $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier); return !empty($composerInfo); } /** * @inheritDoc */ public function getContents(string $url): Response { throw new \BadMethodCallException('Not implemented/used in PerforceDriver'); } /** * @inheritDoc */ public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool { if ($deep || Preg::isMatch('#\b(perforce|p4)\b#i', $url)) { return Perforce::checkServerExists($url, new ProcessExecutor($io)); } return false; } /** * @inheritDoc */ public function cleanup(): void { $this->perforce->cleanupClientSpec(); $this->perforce = null; } public function getDepot(): string { return $this->depot; } public function getBranch(): string { return $this->branch; } }__halt_compiler();----SIGNATURE:----WjiyASIGIIcVzFuFHCsV1Ka8oE1WZ1EMNHWZlIz0PmR27TVLf82d8D+wncdnN2k6m7in3elI91R3QRgXzUw6gksA8o1zKOpe6ey3wKngaA4WgCwJXvtV/7myO86iS6HKCTyC6gJW8a0z2ufqXay/22G2v7XhL/q8tdfQGDbINiuRX3+f8OUTYHrBPT7lTvOF4t2lMDc5yIh86gLFyRBIqEblT2e4r11AYhfG8MqcuMyujLh6AeivNnSW0ac00ARHYFtasmGTgQaYucuBfZCHqRf9ZhurdTnK/FlxWKy1hi6UyKMjR8CN1w78tjFvxzrnWQlBTRiRQcvTO3+opXy9HvY6s/j710aFk1VeZWYPyaSZ2LVap6DTwnIBTKPKLyrA4wRDbTghBKLz6hSkQf6X9rOpEC7KQXszT3LqNp6ZHmRThd2D+YaAQHfRIE910xO6db7t6jdZFgtIojArJK4fduIoJ4jE7qlu49ptyDWC21Gzz+iybcQYaNsyzy2sMJTn0wQxKowIyup8ydmbHN8SQqIPRi/ZwKVXrh1QtF6pCal4StOE8LODc9SuZ+z3G+KVqX2TG+iP1NoLvR6vqMa7kdWWopQ2glg7uGsyShR/jNWtqzIlNmSyJ9CkZcznAC5BHngpGGsbDKaKzRdhBJ5+Wf0nLvgs8ifycjwinpgVZJc=----ATTACHMENT:----MTg5MzI5ODM1NjYzMTcyMSAzMzUyMDc4MjMxMjUyMDExIDUyMDkzOTgyMjU3MDk4Mg==