public function getBranches()
    {
        static $cache = array();

        if (array_key_exists($this->path, $cache)) {
            return $cache[$this->path];
        }

        $branches = $this->getClient()->run($this, 'branch');
        $branches = explode("\n", $branches);
        $branches = array_filter(preg_replace('/[\*\s]/', '', $branches));

        if (empty($branches)) {
            return $cache[$this->path] = $branches;
        }

        // Since we've stripped whitespace, the result "* (detached from "
        // and "* (no branch)" that is displayed in detached HEAD state
        // becomes "(detachedfrom" and "(nobranch)" respectively.
        if ((0 === strpos($branches[0], '(detachedfrom')) || ('(nobranch)' === $branches[0])) {
            $branches = array_slice($branches, 1);
        }

        return $cache[$this->path] = $branches;
    }
public function getBranches()
    {
        static $cache = array();

        if (array_key_exists($this->path, $cache)) {
            return $cache[$this->path];
        }

        $branches = $this->getClient()->run($this, 'branch');
        $branches = explode("\n", $branches);
        $branches = array_filter(preg_replace('/[\*\s]/', '', $branches));

        if (empty($branches)) {
            return $cache[$this->path] = $branches;
        }

        // Since we've stripped whitespace, the result "* (detached from "
        // and "* (no branch)" that is displayed in detached HEAD state
        // becomes "(detachedfrom" and "(nobranch)" respectively.
        if ((0 === strpos($branches[0], '(detachedfrom')) || ('(nobranch)' === $branches[0])) {
            $branches = array_slice($branches, 1);
        }

        return $cache[$this->path] = $branches;
    }
public function getBranches ( ) { static $ cache = array ( ) ; if ( array_key_exists ( $ this -> path , $ cache ) ) { return $ cache [ $ this -> path ] ; } $ branches = $ this -> getClient ( ) -> run ( $ this , 'branch' ) ; $ branches = explode ( "\n" , $ branches ) ; $ branches = array_filter ( preg_replace ( '/[\*\s]/' , '' , $ branches ) ) ; if ( empty ( $ branches ) ) { return $ cache [ $ this -> path ] = $ branches ; } // Since we've stripped whitespace, the result "* (detached from " // and "* (no branch)" that is displayed in detached HEAD state // becomes "(detachedfrom" and "(nobranch)" respectively. if ( ( 0 === strpos ( $ branches [ 0 ] , '(detachedfrom' ) ) || ( '(nobranch)' === $ branches [ 0 ] ) ) { $ branches = array_slice ( $ branches , 1 ) ; } return $ cache [ $ this -> path ] = $ branches ; }
Show a list of the repository branches.

@return array List of branches
Show a list of the repository branches .