*/ 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:----3UBdtRrNB1aGHzKHfCEH1NoCrs1iaCPG5vBplPLnH/a9dKCFcHkLUo6Yst5lxyW8VecPGP3f5dSN616yBkdoIfBxfhsl0uO2863Jbm2devhcdT47oBs9jV18BoEcj95vQ96VO1hUtTIWwtWQ/N3Vj90fR7gg1dm6Dfva7qTOh4FD5DL4j3Q5+/ckEW/N1Ko4rZQCWXrKX4IJQoQQjdcZb79lkrnMSso7jL84Cq90s4ITAndwY8dXldKh9rrs5kFSGpV9UjXU41STvylaqu8sleKRGMMOSknKRkqGELhL2kvYhDcN7NyAaI0nj/Vm+F8XpUuIxcr09WxRU10yIl1c+5oqUe3zdvpG/KzKW8FP8IUui8Iceo36AdplixbITdAfO/kMShD9zHKdpCdBNVYXY75/JwEHRySW9Z6XX+QAkVohOg1mNwkzELdRHvnzLoWQGpZGOX0q2syBGMyY6GAl/KpU08v+JsAh0OT3UsU7JsEJLZrG1BqYDZvHUtCs6bc/RbPzi+z1rjIBqNaC5hbnxJ+9CoNqqoeAT9zwbesJq4mtm/4UeHgRjwun/oLIEqunEvCy+22ZxQ2UE4Tba+sNVW982qO7KtBPzvBWkn4Ohlw2CXOg/l463316TlCcBLV1HVB0+g2uOaXAJnS82FyuFogySGnjOY+ewZKcpcsZoPA=----ATTACHMENT:----NjA3ODgwOTMwMTY4NDM4IDMyNzUyMDEwODYxNTk0MzYgOTMwOTk2MTExNzU4MTQxNA==