Gittern\Gaufrette\GitternIndexAdapter::write PHP Method

write() public method

public write ( $key, $content, array $metadata = null )
$metadata array
    public function write($key, $content, array $metadata = null)
    {
        $blob = new Blob();
        $blob->setContents($content);
        $this->repo->desiccateGitObject($blob);
        $entry = new IndexEntry();
        $entry->setCtime(time() . ".0");
        $entry->setMtime(time() . ".0");
        $entry->setDev(0);
        $entry->setInode(0);
        $entry->setMode(0100644);
        $entry->setUid(0);
        $entry->setGid(0);
        $entry->setFileSize(strlen($content));
        $entry->setBlob($blob);
        $entry->setName($key);
        $entry->setStage(0);
        $this->getIndex()->addEntry($entry);
        $this->flushIfSupposedTo();
    }