function GitBitbucketDriver::getChangeDate
@inheritDoc
Overrides VcsDriverInterface::getChangeDate
File
-
vendor/
composer/ composer/ src/ Composer/ Repository/ Vcs/ GitBitbucketDriver.php, line 241
Class
- GitBitbucketDriver
- @author Per Bernhardt <plb@webfactory.de>
Namespace
Composer\Repository\VcsCode
public function getChangeDate(string $identifier) : ?\DateTimeImmutable {
if ($this->fallbackDriver) {
return $this->fallbackDriver
->getChangeDate($identifier);
}
if (strpos($identifier, '/') !== false) {
$branches = $this->getBranches();
if (isset($branches[$identifier])) {
$identifier = $branches[$identifier];
}
}
$resource = sprintf('https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date', $this->owner, $this->repository, $identifier);
$commit = $this->fetchWithOAuthCredentials($resource)
->decodeJson();
return new \DateTimeImmutable($commit['date']);
}