Gittern\Entity\GitObject\Tree::setSha PHP Method

setSha() public method

Author: Magnus Nordlander
public setSha ( $sha )
    public function setSha($sha)
    {
        $this->sha = $sha;
    }

Usage Example

Beispiel #1
0
 public function hydrate(RawObject $raw_object)
 {
     $tree = new Tree();
     $tree->setSha($raw_object->getSha());
     $reader = new StringReader($raw_object->getData());
     while ($reader->available()) {
         $mode = intval($this->readModeString($reader), 8);
         $name = $this->readName($reader);
         $sha = $reader->readHHex(20);
         $is_tree = (bool) ($mode & 040000);
         if ($is_tree) {
             $node = new Node\TreeNode();
             $node->setTree(new TreeProxy($this->repo, $sha));
         } else {
             $node = new Node\BlobNode();
             $node->setBlob(new BlobProxy($this->repo, $sha));
         }
         $node->setIntegerMode($mode);
         $node->setName($name);
         $tree->addNode($node);
     }
     return $tree;
 }