function Perforce::isLoggedIn
1 call to Perforce::isLoggedIn()
- Perforce::p4Login in vendor/
composer/ composer/ src/ Composer/ Util/ Perforce.php
File
-
vendor/
composer/ composer/ src/ Composer/ Util/ Perforce.php, line 323
Class
- Perforce
- @author Matt Whittom <Matt.Whittom@veteransunited.com>
Namespace
Composer\UtilCode
public function isLoggedIn() : bool {
$command = $this->generateP4Command('login -s', false);
$exitCode = $this->executeCommand($command);
if ($exitCode) {
$errorOutput = $this->process
->getErrorOutput();
$index = strpos($errorOutput, $this->getUser());
if ($index === false) {
$index = strpos($errorOutput, 'p4');
if ($index === false) {
return false;
}
throw new \Exception('p4 command not found in path: ' . $errorOutput);
}
throw new \Exception('Invalid user name: ' . $this->getUser());
}
return true;
}