public function getBranches(bool $namesOnly = false, bool $all = false)
    {
        $branches = [];
        if ($namesOnly) {
            $outputLines = $this->caller
                ->execute(BranchCommand::getInstance($this)->listBranches($all, true))
                ->getOutputLines(true);

            $branches = array_map(
                function ($v) {
                    return ltrim($v, '* ');
                },
                $outputLines
            );
        } else {
            $outputLines = $this->caller
                ->execute(BranchCommand::getInstance($this)->listBranches($all))
                ->getOutputLines(true);

            foreach ($outputLines as $branchLine) {
                $branches[] = Branch::createFromOutputLine($this, $branchLine);
            }
        }

        return $branches;
    }