芝麻web文件管理V1.00
编辑当前文件:/home/sditechnicalteam/public_html/vendor/gitonomy/gitlib/src/Gitonomy/Git/Reference/Branch.php
* (c) Julien DIDIER
* * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace Gitonomy\Git\Reference; use Gitonomy\Git\Exception\RuntimeException; use Gitonomy\Git\Reference; /** * Representation of a branch reference. * * @author Alexandre Salomé
*/ class Branch extends Reference { private $local = null; public function getName() { $fullname = $this->getFullname(); if (preg_match('#^refs/heads/(?
.*)$#', $fullname, $vars)) { return $vars['name']; } if (preg_match('#^refs/remotes/(?
[^/]*)/(?
.*)$#', $fullname, $vars)) { return $vars['remote'].'/'.$vars['name']; } throw new RuntimeException(sprintf('Cannot extract branch name from "%s"', $fullname)); } public function isRemote() { $this->detectBranchType(); return !$this->local; } public function isLocal() { $this->detectBranchType(); return $this->local; } private function detectBranchType() { if (null === $this->local) { $this->local = !preg_match('#^refs/remotes/(?
[^/]*)/(?
.*)$#', $this->getFullname()); } } }