Рекурсивный акроним словосочетания «PHP: Hypertext Preprocessor»
Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 16693 программиста и 1769 роботов. Сейчас ищут 1197 программистов ...
The blob object (VersionControl_Git_Object_Blob)
Вернуться к: Tutorial
An instance of the VersionControl_Git_Object_Blob represents tree object in Git. It has contents of the file.
It can get via VersionControl_Git_Object_Tree
<?php
require_once 'VersionControl/Git.php';
$git = new VersionControl_Git('/home/co3k/sf/op3-ebihara');
$commits = $git->getCommits();
$tree = $git->getTree($commits[0]->getTree());
$tree->fetch();
$blob = $tree->current();
var_dump($blob);
/*
results:
object(VersionControl_Git_Object_Blob)#304 (3) {
}
*/
The instance doesn't have any contents at the first. If you want to get contents, call the getContents() after calling the fetch() method.
<?php
require_once 'VersionControl/Git.php';
$git = new VersionControl_Git('/home/co3k/sf/op3-ebihara');
$commits = $git->getCommits();
$tree = $git->getTree($commits[0]->getTree());
$tree->fetch();
$blob = $tree->current()->fetch();
var_dump($blob->getContent());
Вернуться к: Tutorial