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;
    }
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;
    }
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 ; }
An array of Branch objects

@param bool $namesOnly return an array of branch names as a string
@param bool $all       lists also remote branches

@throws \RuntimeException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\LogicException
@throws \InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return array
An array of Branch objects