function Perforce::getFilePath
1 call to Perforce::getFilePath()
- Perforce::getFileContent in vendor/
composer/ composer/ src/ Composer/ Util/ Perforce.php
File
-
vendor/
composer/ composer/ src/ Composer/ Util/ Perforce.php, line 472
Class
- Perforce
- @author Matt Whittom <Matt.Whittom@veteransunited.com>
Namespace
Composer\UtilCode
public function getFilePath(string $file, string $identifier) : ?string {
$index = strpos($identifier, '@');
if ($index === false) {
return $identifier . '/' . $file;
}
$path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
$command = $this->generateP4Command(' files ' . ProcessExecutor::escape($path), false);
$this->executeCommand($command);
$result = $this->commandResult;
$index2 = strpos($result, 'no such file(s).');
if ($index2 === false) {
$index3 = strpos($result, 'change');
if ($index3 !== false) {
$phrase = trim(substr($result, $index3));
$fields = explode(' ', $phrase);
return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
}
}
return null;
}