當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Git::getTypeName方法代碼示例

本文整理匯總了PHP中Git::getTypeName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Git::getTypeName方法的具體用法?PHP Git::getTypeName怎麽用?PHP Git::getTypeName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Git的用法示例。


在下文中一共展示了Git::getTypeName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: git_read_tag

function git_read_tag($proj, $tag_id)
{
    $obj = $proj->getObject($tag_id);
    if ($obj->getType() != Git::OBJ_TAG) {
        return;
    }
    $tag['id'] = sha1_hex($tag_id);
    if ($obj->object !== null) {
        $tag['object'] = sha1_hex($obj->object);
    }
    if ($obj->objtype !== null) {
        $tag['type'] = Git::getTypeName($obj->objtype);
    }
    if ($obj->tag !== null) {
        $tag['name'] = $obj->tag;
    }
    if ($obj->tagger !== null) {
        $tag['author'] = $obj->tagger->name;
        $tag['epoch'] = $obj->tagger->time;
        $tag['tz'] = sprintf("%+03d%02d", $obj->tagger->offset / 3600, abs($obj->tagger->offset % 3600 / 60));
    }
    $tag['comment'] = explode("\n", $obj->summary . "\n" . $obj->detail);
    if (!isset($tag['name'])) {
        return null;
    }
    return $tag;
}
開發者ID:akumpf,項目名稱:gitphp-glip,代碼行數:27,代碼來源:glip.git_read_tag.php

示例2: write

 /**
  * @brief Write this object in its serialized form to the git repository
  * given at creation time.
  */
 public function write()
 {
     $sha1 = sha1_hex($this->name);
     $path = sprintf('%s/objects/%s/%s', $this->repo->dir, substr($sha1, 0, 2), substr($sha1, 2));
     if (file_exists($path)) {
         return FALSE;
     }
     $dir = dirname($path);
     if (!is_dir($dir)) {
         mkdir(dirname($path), 0770);
     }
     $f = fopen($path, 'ab');
     flock($f, LOCK_EX);
     ftruncate($f, 0);
     $data = $this->serialize();
     $data = Git::getTypeName($this->type) . ' ' . strlen($data) . "" . $data;
     fwrite($f, gzcompress($data));
     fclose($f);
     return TRUE;
 }
開發者ID:halstead,項目名稱:glip,代碼行數:24,代碼來源:git_object.class.php

示例3: addObject

 protected function addObject($obj, $data)
 {
     $hash = hash_init("sha1");
     hash_update($hash, Git::getTypeName($obj->type));
     hash_update($hash, ' ');
     hash_update($hash, strlen($data));
     hash_update($hash, "");
     hash_update($hash, $data);
     $hash = hash_final($hash, true);
     if (isset($this->objects[$hash])) {
         throw new Exception(sprintf("duplicate object %s\n", sha1_hex($hash)));
     }
     $this->objects[$hash] = $obj;
     return $hash;
 }
開發者ID:halstead,項目名稱:glip,代碼行數:15,代碼來源:git_index_pack.php

示例4: _serialize

 public function _serialize()
 {
     $s = '';
     if ($this->object !== null) {
         $s .= sprintf("object %s\n", sha1_hex($this->object));
         $s .= sprintf("type %s\n", Git::getTypeName($this->objtype));
     }
     if ($this->tag !== null) {
         $s .= sprintf("tag %s\n", $this->tagger->serialize());
     }
     if ($this->tagger !== null) {
         $s .= sprintf("tagger %s\n", $this->tagger->serialize());
     }
     $s .= "\n" . $this->summary . "\n" . $this->detail;
     return $s;
 }
開發者ID:halstead,項目名稱:glip,代碼行數:16,代碼來源:git_tag.class.php


注:本文中的Git::getTypeName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。