*/ 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:----bcQ1PoqhEdYOlQKzd7F3S3ChNtKoHkfNJp8QHQKX8XGeKMsEiGgGXM0dkMYbqyd2g5Tj+7qm0O7/SoUJ35SmEVE6T2k7+P3P/NFWMBMIaFAUJSu/rft/AiouHI/wLGpBUtXMOoXvRFwrxoN/KAhx6G78CSBet05k8bf9sPodh+5hfF3wp5kGjBOqsb6vYocEz+ivaVHGP+15amMmlizsmrOp1fG7byfveYo2k2wPydphU/u1dXiqdsQcrL7Ajq0U+rqcYJjFq784/APeMz6RsbZlZNP/LVAjROhqZQ3ZUiO/2k2x/OBM3efiFiACZzoFIMpRMVrYgu73BO3zfwsm/HokpIsTAWUFoh+rmVztoiUjZwXjP9ctI0etwt7E1bqYwS1+h25rccHo7YWW9gU4xethxQLu1JUrz28XjBL2h66E/NXMk8ou2Sm9BG8OI0TIY0YHQs61+SKcKltvjGgz31Yicivrlk3cCts0yjVs5eimUYWGcvw/9C/yE0T0werpFIBZlBBHr5lf1Y72fXzKdXp8mgkqHV7vo3sRqCfKOxffbVerykeDOUMVEMunh6hLxS7nPG1l5CDdZULxCt2p9hsXggtEja6jvHl8qB8EI3YhSZSM7Xh6TI19YkhYxEn/pqZnPSuvREdjsycbwe284tnJry3vn2B5lcRLd3NhlVA=----ATTACHMENT:----ODI4MDIyMTgyNTI5MDA3NCA2NjM0NjY4MjU4MDc3NTAxIDMyNTUyMjYzMjc1Njk4OA==