updated-packages

This commit is contained in:
RafficMohammed
2023-01-08 00:13:22 +05:30
parent 3ff7df7487
commit da241bacb6
12659 changed files with 563377 additions and 510538 deletions

View File

@@ -9,12 +9,14 @@
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Gitonomy\Git;
use Gitonomy\Git\Diff\Diff;
use Gitonomy\Git\Exception\InvalidArgumentException;
use Gitonomy\Git\Exception\ProcessException;
use Gitonomy\Git\Exception\ReferenceNotFoundException;
use Gitonomy\Git\Reference\Branch;
use Gitonomy\Git\Util\StringHelper;
/**
@@ -29,15 +31,15 @@ class Commit extends Revision
*
* @var array
*/
private $data = array();
private $data = [];
/**
* Constructor.
*
* @param Gitonomy\Git\Repository $repository Repository of the commit
* @param string $hash Hash of the commit
* @param Repository $repository Repository of the commit
* @param string $hash Hash of the commit
*/
public function __construct(Repository $repository, $hash, array $data = array())
public function __construct(Repository $repository, $hash, array $data = [])
{
if (!preg_match('/^[a-f0-9]{40}$/', $hash)) {
throw new ReferenceNotFoundException($hash);
@@ -60,7 +62,7 @@ class Commit extends Revision
*/
public function getDiff()
{
$args = array('-r', '-p', '-m', '-M', '--no-commit-id', '--full-index', $this->revision);
$args = ['-r', '-p', '-m', '-M', '--no-commit-id', '--full-index', $this->revision];
$diff = Diff::parse($this->repository->run('diff-tree', $args));
$diff->setRepository($this->repository);
@@ -90,6 +92,8 @@ class Commit extends Revision
/**
* Returns a fixed-with short hash.
*
* @return string Short hash
*/
public function getFixedShortHash($length = 6)
{
@@ -99,7 +103,7 @@ class Commit extends Revision
/**
* Returns parent hashes.
*
* @return array An array of SHA1 hashes
* @return string[] An array of SHA1 hashes
*/
public function getParentHashes()
{
@@ -109,11 +113,11 @@ class Commit extends Revision
/**
* Returns the parent commits.
*
* @return array An array of Commit objects
* @return Commit[] An array of Commit objects
*/
public function getParents()
{
$result = array();
$result = [];
foreach ($this->getData('parentHashes') as $parentHash) {
$result[] = $this->repository->getCommit($parentHash);
}
@@ -131,6 +135,9 @@ class Commit extends Revision
return $this->getData('treeHash');
}
/**
* @return Tree
*/
public function getTree()
{
return $this->getData('tree');
@@ -149,7 +156,7 @@ class Commit extends Revision
$path = $getWorkingDir.'/'.$path;
}
$result = $this->repository->run('log', array('--format=%H', '-n', 1, $this->revision, '--', $path));
$result = $this->repository->run('log', ['--format=%H', '-n', 1, $this->revision, '--', $path]);
return $this->repository->getCommit(trim($result));
}
@@ -183,7 +190,7 @@ class Commit extends Revision
/**
* Resolves all references associated to this commit.
*
* @return array An array of references (Branch, Tag, Squash)
* @return Reference[] An array of references (Branch, Tag, Squash)
*/
public function resolveReferences()
{
@@ -196,11 +203,11 @@ class Commit extends Revision
* @param bool $local set true to try to locate a commit on local repository
* @param bool $remote set true to try to locate a commit on remote repository
*
* @return array An array of Reference\Branch
* @return Reference[]|Branch[] An array of Reference\Branch
*/
public function getIncludingBranches($local = true, $remote = true)
{
$arguments = array('--contains', $this->revision);
$arguments = ['--contains', $this->revision];
if ($local && $remote) {
$arguments[] = '-a';
@@ -213,20 +220,22 @@ class Commit extends Revision
try {
$result = $this->repository->run('branch', $arguments);
} catch (ProcessException $e) {
return array();
return [];
}
if (!$result) {
return array();
return [];
}
$branchesName = explode("\n", trim(str_replace('*', '', $result)));
$branchesName = array_filter($branchesName, function ($v) { return false === StringHelper::strpos($v, '->');});
$branchesName = array_filter($branchesName, function ($v) {
return false === StringHelper::strpos($v, '->');
});
$branchesName = array_map('trim', $branchesName);
$references = $this->repository->getReferences();
$branches = array();
$branches = [];
foreach ($branchesName as $branchName) {
if (false === $local) {
$branches[] = $references->getRemoteBranch($branchName);
@@ -263,7 +272,7 @@ class Commit extends Revision
/**
* Returns the authoring date.
*
* @return DateTime A time object
* @return \DateTime A time object
*/
public function getAuthorDate()
{
@@ -293,7 +302,7 @@ class Commit extends Revision
/**
* Returns the authoring date.
*
* @return DateTime A time object
* @return \DateTime A time object
*/
public function getCommitterDate()
{
@@ -331,7 +340,7 @@ class Commit extends Revision
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function getCommit()
{
@@ -345,7 +354,7 @@ class Commit extends Revision
}
if ($name === 'shortHash') {
$this->data['shortHash'] = trim($this->repository->run('log', array('--abbrev-commit', '--format=%h', '-n', 1, $this->revision)));
$this->data['shortHash'] = trim($this->repository->run('log', ['--abbrev-commit', '--format=%h', '-n', 1, $this->revision]));
return $this->data['shortHash'];
}
@@ -377,8 +386,9 @@ class Commit extends Revision
}
$parser = new Parser\CommitParser();
try {
$result = $this->repository->run('cat-file', array('commit', $this->revision));
$result = $this->repository->run('cat-file', ['commit', $this->revision]);
} catch (ProcessException $e) {
throw new ReferenceNotFoundException(sprintf('Can not find reference "%s"', $this->revision));
}