示例#1
0
文件: GitTree.php 项目: Ennosuke/glip
 public function unserialize($data)
 {
     parent::unserialize($data);
     $this->nodes = array();
     $start = 0;
     while ($start < strlen($data)) {
         $node = new stdClass();
         $pos = strpos($data, "", $start);
         list($node->mode, $node->name) = explode(' ', substr($data, $start, $pos - $start), 2);
         $node->mode = intval($node->mode, 8);
         $node->is_dir = !!($node->mode & 040000);
         $node->is_submodule = $node->mode == 57344;
         $node->object = substr($data, $pos + 1, 20);
         $start = $pos + 21;
         $this->nodes[$node->name] = $node;
     }
     unset($data);
 }
示例#2
0
文件: GitTag.php 项目: Ennosuke/glip
 public function unserialize($data)
 {
     parent::unserialize($data);
     $lines = explode("\n", $data);
     unset($data);
     $meta = [];
     while (($line = array_shift($lines)) != '') {
         $parts = explode(' ', $line, 2);
         if (!isset($meta[$parts[0]])) {
             $meta[$parts[0]] = [$parts[1]];
         } else {
             $meta[$parts[0]][] = $parts[1];
         }
     }
     $this->object = Git::sha1Bin($meta['object'][0]);
     $this->type = $meta['type'][0];
     $this->tag = $meta['tag'][0];
     $this->tagger = new GitStamp();
     $this->tagger->unserialize($meta['tagger'][0]);
     $this->message = implode("\n", $lines);
 }
示例#3
0
 public function unserialize($data)
 {
     parent::unserialize($data);
     $lines = explode("\n", $data);
     unset($data);
     $meta = array('parent' => array());
     while (($line = array_shift($lines)) != '') {
         $parts = explode(' ', $line, 2);
         if (!isset($meta[$parts[0]])) {
             $meta[$parts[0]] = array($parts[1]);
         } else {
             $meta[$parts[0]][] = $parts[1];
         }
     }
     $this->tree = Git::sha1Bin($meta['tree'][0]);
     $this->parents = array_map(array("ennosuke\\glip\\Git", "sha1Bin"), $meta['parent']);
     $this->author = new GitStamp();
     $this->author->unserialize($meta['author'][0]);
     $this->committer = new GitStamp();
     $this->committer->unserialize($meta['committer'][0]);
     $this->summary = array_shift($lines);
     $this->detail = implode("\n", $lines);
     $this->history = null;
 }
示例#4
0
文件: GitBlob.php 项目: Ennosuke/glip
 public function unserialize($data)
 {
     parent::unserialize($data);
     $this->data = $data;
 }