diff --git a/src/GitElephant/Command/BaseCommand.php b/src/GitElephant/Command/BaseCommand.php index 751c0234..7540d2a6 100644 --- a/src/GitElephant/Command/BaseCommand.php +++ b/src/GitElephant/Command/BaseCommand.php @@ -312,7 +312,7 @@ public function normalizeOptions( } } } - + return $normalizedOptions; } @@ -353,6 +353,7 @@ private function getCLICommandArguments(): string if (count($combinedArguments) > 0) { $command .= ' ' . implode(' ', array_map('escapeshellarg', $combinedArguments)); } + return $command; } @@ -385,6 +386,7 @@ private function getCLIConfigs(): string ); } } + return $command; } @@ -401,6 +403,7 @@ private function getCLIGlobalOptions(): string $command .= sprintf(' %s=%s', escapeshellarg($name), escapeshellarg($value)); } } + return $command; } @@ -415,6 +418,7 @@ private function getCLIPath(): string if (!is_null($this->path)) { $command .= sprintf(' -- %s', escapeshellarg($this->path)); } + return $command; } @@ -447,6 +451,7 @@ private function getCLISubjects(): string $command .= escapeshellarg($this->commandSubject2); } } + return $command; } @@ -458,6 +463,7 @@ public function getBinaryVersion(): string if (is_null($this->binaryVersion)) { $this->binaryVersion = $this->repo->getCaller()->getBinaryVersion(); } + return $this->binaryVersion; } } diff --git a/src/GitElephant/Command/BranchCommand.php b/src/GitElephant/Command/BranchCommand.php index 86932875..2b8b8d89 100644 --- a/src/GitElephant/Command/BranchCommand.php +++ b/src/GitElephant/Command/BranchCommand.php @@ -77,6 +77,7 @@ public function create(string $name, string $startPoint = null): string if (null !== $startPoint) { $this->addCommandSubject2($startPoint); } + return $this->getCommand(); } diff --git a/src/GitElephant/Command/Caller/AbstractCaller.php b/src/GitElephant/Command/Caller/AbstractCaller.php index 35b10b7a..2e15b238 100644 --- a/src/GitElephant/Command/Caller/AbstractCaller.php +++ b/src/GitElephant/Command/Caller/AbstractCaller.php @@ -114,6 +114,7 @@ public function getOutputLines(bool $stripBlankLines = false): array return $output; } + return $this->outputLines; } } diff --git a/src/GitElephant/Command/Caller/Caller.php b/src/GitElephant/Command/Caller/Caller.php index 7d63def7..86efe180 100644 --- a/src/GitElephant/Command/Caller/Caller.php +++ b/src/GitElephant/Command/Caller/Caller.php @@ -148,6 +148,7 @@ public function getOutputLines(bool $stripBlankLines = false): array return $output; } + return $this->outputLines; } diff --git a/src/GitElephant/Command/CloneCommand.php b/src/GitElephant/Command/CloneCommand.php index 14298d74..e8a2011e 100644 --- a/src/GitElephant/Command/CloneCommand.php +++ b/src/GitElephant/Command/CloneCommand.php @@ -90,6 +90,7 @@ public function cloneUrl( if ($recursive) { $this->addCommandArgument('--recursive'); } + return $this->getCommand(); } } diff --git a/src/GitElephant/Command/FetchCommand.php b/src/GitElephant/Command/FetchCommand.php index 5bcd55b3..3d4da9f5 100644 --- a/src/GitElephant/Command/FetchCommand.php +++ b/src/GitElephant/Command/FetchCommand.php @@ -71,6 +71,7 @@ public function fetch($remote = null, $branch = null, array $options = []): stri if (!is_null($branch)) { $this->addCommandSubject2($branch); } + return $this->getCommand(); } diff --git a/src/GitElephant/Command/LogCommand.php b/src/GitElephant/Command/LogCommand.php index 90503238..78a10ac6 100644 --- a/src/GitElephant/Command/LogCommand.php +++ b/src/GitElephant/Command/LogCommand.php @@ -67,6 +67,7 @@ public function showObjectLog(NodeObject $obj, $branch = null, int $limit = null $subject .= (string) $branch; } } + return $this->showLog($subject, $obj->getFullPath(), $limit, $offset); } diff --git a/src/GitElephant/Command/MainCommand.php b/src/GitElephant/Command/MainCommand.php index a48ad2ab..d8f2ae9c 100644 --- a/src/GitElephant/Command/MainCommand.php +++ b/src/GitElephant/Command/MainCommand.php @@ -88,6 +88,7 @@ public function status($porcelain = false): string } else { $this->addConfigs(['color.status' => 'false']); } + return $this->getCommand(); } diff --git a/src/GitElephant/Command/PullCommand.php b/src/GitElephant/Command/PullCommand.php index e4e953d3..d0dffb88 100644 --- a/src/GitElephant/Command/PullCommand.php +++ b/src/GitElephant/Command/PullCommand.php @@ -69,6 +69,7 @@ public function pull($remote = null, $branch = null, $rebase = false): string if (!is_null($branch)) { $this->addCommandSubject2($branch); } + return $this->getCommand(); } } diff --git a/src/GitElephant/Command/PushCommand.php b/src/GitElephant/Command/PushCommand.php index e2b3d1a1..86074a9d 100644 --- a/src/GitElephant/Command/PushCommand.php +++ b/src/GitElephant/Command/PushCommand.php @@ -64,6 +64,7 @@ public function push($remote = 'origin', $branch = 'master', string $args = null if (!is_null($args)) { $this->addCommandArgument($args); } + return $this->getCommand(); } } diff --git a/src/GitElephant/Command/Remote/AddSubCommand.php b/src/GitElephant/Command/Remote/AddSubCommand.php index 542948c5..7fa800a8 100644 --- a/src/GitElephant/Command/Remote/AddSubCommand.php +++ b/src/GitElephant/Command/Remote/AddSubCommand.php @@ -103,6 +103,7 @@ public function prepare($name, $url, $options = []): self foreach ($options as $option) { $this->addCommandArgument($option); } + return $this; } } diff --git a/src/GitElephant/Command/Remote/ShowSubCommand.php b/src/GitElephant/Command/Remote/ShowSubCommand.php index 38fe759d..7f9e49ca 100644 --- a/src/GitElephant/Command/Remote/ShowSubCommand.php +++ b/src/GitElephant/Command/Remote/ShowSubCommand.php @@ -72,6 +72,7 @@ public function prepare($name = null, $queryRemotes = true): self if (!$queryRemotes) { $this->addCommandArgument('-n'); } + return $this; } } diff --git a/src/GitElephant/Command/RemoteCommand.php b/src/GitElephant/Command/RemoteCommand.php index 41f2cd49..3763b3ab 100644 --- a/src/GitElephant/Command/RemoteCommand.php +++ b/src/GitElephant/Command/RemoteCommand.php @@ -73,6 +73,7 @@ public function remote(SubCommandCommand $subcommand = null, array $options = [] if ($subcommand !== null) { $this->addCommandSubject($subcommand); } + return $this->getCommand(); } diff --git a/src/GitElephant/Command/ResetCommand.php b/src/GitElephant/Command/ResetCommand.php index 3d9c6517..b71c8ff7 100644 --- a/src/GitElephant/Command/ResetCommand.php +++ b/src/GitElephant/Command/ResetCommand.php @@ -52,6 +52,7 @@ public function reset($arg = null, array $options = []): string if ($arg != null) { $this->addCommandSubject2($arg); } + return $this->getCommand(); } diff --git a/src/GitElephant/Command/RevParseCommand.php b/src/GitElephant/Command/RevParseCommand.php index 81baa299..e2ee96f8 100644 --- a/src/GitElephant/Command/RevParseCommand.php +++ b/src/GitElephant/Command/RevParseCommand.php @@ -99,6 +99,7 @@ public function revParse($arg = null, array $options = []): string if (!is_null($arg)) { $this->addCommandSubject2($arg); } + return $this->getCommand(); } } diff --git a/src/GitElephant/Command/StashCommand.php b/src/GitElephant/Command/StashCommand.php index f034abda..c67bd880 100644 --- a/src/GitElephant/Command/StashCommand.php +++ b/src/GitElephant/Command/StashCommand.php @@ -65,6 +65,7 @@ public function save($message = null, $includeUntracked = false, $keepIndex = fa if ($keepIndex) { $this->addCommandArgument('--keep-index'); } + return $this->getCommand(); } @@ -82,6 +83,7 @@ public function listStashes(array $options = null): string if (null !== $options) { $this->addCommandSubject($options); } + return $this->getCommand(); } @@ -136,6 +138,7 @@ public function apply($stash, $index = false): string if ($index) { $this->addCommandArgument('--index'); } + return $this->getCommand(); } @@ -156,6 +159,7 @@ public function pop($stash, $index = false): string if ($index) { $this->addCommandArgument('--index'); } + return $this->getCommand(); } @@ -211,6 +215,7 @@ private function normalizeStashName($stash): string if (0 !== strpos($stash, 'stash@{')) { $stash = 'stash@{' . $stash . '}'; } + return $stash; } } diff --git a/src/GitElephant/Command/SubmoduleCommand.php b/src/GitElephant/Command/SubmoduleCommand.php index 41344993..d29d57d0 100644 --- a/src/GitElephant/Command/SubmoduleCommand.php +++ b/src/GitElephant/Command/SubmoduleCommand.php @@ -65,6 +65,7 @@ public function add($gitUrl, $path = null): string if (null !== $path) { $this->addCommandSubject($path); } + return $this->getCommand(); } @@ -82,6 +83,7 @@ public function init($path = null): string if (null !== $path) { $this->addPath($path); } + return $this->getCommand(); } @@ -140,6 +142,7 @@ public function update($recursive = false, $init = false, $force = false, $path if ($path !== null) { $this->addPath($path); } + return $this->getCommand(); } } diff --git a/src/GitElephant/Command/TagCommand.php b/src/GitElephant/Command/TagCommand.php index 15f5659c..89df649a 100644 --- a/src/GitElephant/Command/TagCommand.php +++ b/src/GitElephant/Command/TagCommand.php @@ -67,6 +67,7 @@ public function create(string $name, $startPoint = null, $message = null): strin } else { $this->addCommandSubject($name); } + return $this->getCommand(); } diff --git a/src/GitElephant/Objects/Branch.php b/src/GitElephant/Objects/Branch.php index be4c0c1a..59e661a1 100644 --- a/src/GitElephant/Objects/Branch.php +++ b/src/GitElephant/Objects/Branch.php @@ -210,6 +210,7 @@ public static function getMatches(string $branchString): array if (empty($matches)) { throw new \InvalidArgumentException(sprintf('the branch string is not valid: %s', $branchString)); } + return array_map('trim', $matches); } diff --git a/src/GitElephant/Objects/NodeObject.php b/src/GitElephant/Objects/NodeObject.php index a6da6357..f73aa224 100644 --- a/src/GitElephant/Objects/NodeObject.php +++ b/src/GitElephant/Objects/NodeObject.php @@ -103,6 +103,7 @@ public static function createFromOutputLine(Repository $repository, string $outp $path = substr($fullPath, 0, $pos); $name = substr($fullPath, $pos + 1); } + return new static( $repository, $slices['permissions'], diff --git a/src/GitElephant/Objects/Remote.php b/src/GitElephant/Objects/Remote.php index ddb89580..6ec225f3 100644 --- a/src/GitElephant/Objects/Remote.php +++ b/src/GitElephant/Objects/Remote.php @@ -90,6 +90,7 @@ public function __construct(Repository $repository, string $name = null, bool $q $this->name = trim($name); $this->createFromCommand($queryRemotes); } + return $this; } @@ -309,6 +310,7 @@ public function parseRemoteBranches(array $lines): array $branches[$parts[0]] = ['local_relationship' => $parts[1]]; } } + return $branches; } @@ -332,6 +334,7 @@ public function parseLocalPullBranches($lines): array $branches[$parts[0]] = ['merges_with' => $parts[1]]; } } + return $branches; } @@ -356,6 +359,7 @@ public function parseLocalPushRefs($lines): array $branches[$parts[0]] = ['pushes_to' => $value[0], 'local_state' => $value[1]]; } } + return $branches; } @@ -374,6 +378,7 @@ public function parseName($line) if (!isset($matches[1])) { return ''; } + return $matches[1]; } @@ -392,6 +397,7 @@ public static function getMatches(string $remoteString): array if (empty($matches)) { throw new \InvalidArgumentException(sprintf('the remote string is not valid: %s', $remoteString)); } + return array_map('trim', $matches); } diff --git a/src/GitElephant/Repository.php b/src/GitElephant/Repository.php index 7ff11652..a76e037d 100644 --- a/src/GitElephant/Repository.php +++ b/src/GitElephant/Repository.php @@ -298,6 +298,7 @@ public function commit(string $message, $stageAll = false, $ref = null, $author if (!is_null($ref)) { $this->checkout($currentBranch); } + return $this; } @@ -476,6 +477,7 @@ function ($v) { $branches[] = Branch::createFromOutputLine($this, $branchLine); } } + return $branches; } @@ -518,6 +520,7 @@ public function getBranch(string $name): ?\GitElephant\Objects\Branch return $branch; } } + return null; } @@ -625,6 +628,7 @@ public function deleteTag($tag): self } else { Tag::pick($this, $tag)->delete(); } + return $this; } @@ -723,6 +727,7 @@ public function getTag(string $name): ?\GitElephant\Objects\Tag return new Tag($this, $name); } } + return null; } @@ -775,6 +780,7 @@ public function getBranchOrTag(string $name) return new Tag($this, $name); } } + return null; } @@ -856,6 +862,7 @@ public function getLogRange( if (preg_match('~^[0]+$~', $refEnd)) { $refEnd = $refStart; } + return new LogRange($this, $refStart, $refEnd, $path, $limit, $offset, $firstParent); } @@ -930,6 +937,7 @@ public function getTree($ref = 'HEAD', $path = null): \GitElephant\Objects\Tree $path = TreeObject::createFromOutputLine($this, $outputLines[0]); } + return new Tree($this, $ref, $path); } @@ -1028,6 +1036,7 @@ public function getRemotes(bool $queryRemotes = true): array foreach ($remoteNames as $remoteName) { $remotes[] = $this->getRemote($remoteName, $queryRemotes); } + return $remotes; } diff --git a/src/GitElephant/Status/StatusFile.php b/src/GitElephant/Status/StatusFile.php index 01bcfd84..7b8bf44f 100644 --- a/src/GitElephant/Status/StatusFile.php +++ b/src/GitElephant/Status/StatusFile.php @@ -194,6 +194,7 @@ public function getDescription(): string if ($this->description === null) { $this->calculateDescription(); } + return $this->description; } diff --git a/src/GitElephant/Utilities.php b/src/GitElephant/Utilities.php index a79425ff..76ef2d5c 100644 --- a/src/GitElephant/Utilities.php +++ b/src/GitElephant/Utilities.php @@ -48,6 +48,7 @@ public static function pregSplitArray(array $list, string $pattern): array $slices[$index][] = $value; } } + return $slices; } @@ -68,6 +69,7 @@ public static function pregSplitFlatArray(array $list, string $pattern): array $slices[$index + 1][] = $value; } + return $slices; } }