public function getBranchOrTag(string $name)
    {
        if (in_array($name, $this->getBranches(true))) {
            return new Branch($this, $name);
        }
        $tagFinderOutput = $this->caller->execute(TagCommand::getInstance($this)->listTags())->getOutputLines(true);
        foreach ($tagFinderOutput as $line) {
            if ($line === $name) {
                return new Tag($this, $name);
            }
        }

        return null;
    }
public function getBranchOrTag(string $name)
    {
        if (in_array($name, $this->getBranches(true))) {
            return new Branch($this, $name);
        }
        $tagFinderOutput = $this->caller->execute(TagCommand::getInstance($this)->listTags())->getOutputLines(true);
        foreach ($tagFinderOutput as $line) {
            if ($line === $name) {
                return new Tag($this, $name);
            }
        }

        return null;
    }
public function getBranchOrTag ( string $ name ) { if ( in_array ( $ name , $ this -> getBranches ( true ) ) ) { return new Branch ( $ this , $ name ) ; } $ tagFinderOutput = $ this -> caller -> execute ( TagCommand :: getInstance ( $ this ) -> listTags ( ) ) -> getOutputLines ( true ) ; foreach ( $ tagFinderOutput as $ line ) { if ( $ line === $ name ) { return new Tag ( $ this , $ name ) ; } } return null ; }
Try to get a branch or a tag by its name.

@param string $name the reference name (a tag name or a branch name)

@throws \RuntimeException
@throws \InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return \GitElephant\Objects\Tag|\GitElephant\Objects\Branch|null
Try to get a branch or a tag by its name .