public function getCurrentBranch()
    {
        $branches = $this->getClient()->run($this, 'branch');
        $branches = explode("\n", $branches);

        foreach ($branches as $branch) {
            if ('*' === $branch[0]) {
                if (preg_match('/(detached|no branch)/', $branch)) {
                    return null;
                }

                return substr($branch, 2);
            }
        }
    }
public function getCurrentBranch()
    {
        $branches = $this->getClient()->run($this, 'branch');
        $branches = explode("\n", $branches);

        foreach ($branches as $branch) {
            if ('*' === $branch[0]) {
                if (preg_match('/(detached|no branch)/', $branch)) {
                    return null;
                }

                return substr($branch, 2);
            }
        }
    }
public function getCurrentBranch ( ) { $ branches = $ this -> getClient ( ) -> run ( $ this , 'branch' ) ; $ branches = explode ( "\n" , $ branches ) ; foreach ( $ branches as $ branch ) { if ( '*' === $ branch [ 0 ] ) { if ( preg_match ( '/(detached|no branch)/' , $ branch ) ) { return null ; } return substr ( $ branch , 2 ) ; } } }
Return the current repository branch.

@return mixed current repository branch as a string, or NULL if in
detached HEAD state
Return the current repository branch .