GitObject Class Reference

Inheritance diagram for GitObject:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 getName ()
 Get the object's cached SHA-1 hash value.
 getType ()
 Get the object's type.
 __construct ($repo, $type)
 Internal constructor for use from derived classes.
 unserialize ($data)
 Populate this object with values from its string representation.
 serialize ()
 Get the string representation of an object.
 rehash ()
 Update the SHA-1 name of an object.
 write ()
 Write this object in its serialized form to the git repository given at creation time.

Static Public Member Functions

static create ($repo, $type)
 Create a GitObject of the specified type.

Public Attributes

 $repo
 (Git) The repository this object belongs to.

Protected Member Functions

 hash ($data)
 Internal function to calculate the hash value of a git object of the current type with content $data.

Protected Attributes

 $type
 $name = NULL


Detailed Description

Definition at line 21 of file git_object.class.php.


Constructor & Destructor Documentation

GitObject::__construct ( repo,
type 
)

Internal constructor for use from derived classes.

Never use this function except from a derived class. Use the constructor of a derived class, create() or Git::getObject() instead.

Definition at line 88 of file git_object.class.php.


Member Function Documentation

static GitObject::create ( repo,
type 
) [static]

Create a GitObject of the specified type.

Parameters:
$repo (Git) The repository the object belongs to.
$type (integer) Object type (one of Git::OBJ_COMMIT, Git::OBJ_TREE, Git::OBJ_BLOB).
Returns:
A new GitCommit, GitTree or GitBlob object respectively.

Definition at line 53 of file git_object.class.php.

GitObject::getName (  ) 

Get the object's cached SHA-1 hash value.

Returns:
(string) The hash value (binary sha1).

Definition at line 35 of file git_object.class.php.

GitObject::getType (  ) 

Get the object's type.

Returns:
(integer) One of Git::OBJ_COMMIT, Git::OBJ_TREE or GIT::OBJ_BLOB.

Definition at line 43 of file git_object.class.php.

GitObject::hash ( data  )  [protected]

Internal function to calculate the hash value of a git object of the current type with content $data.

Parameters:
$data (string) The data to hash.
Returns:
(string) The hash value (binary sha1).

Definition at line 71 of file git_object.class.php.

GitObject::rehash (  ) 

Update the SHA-1 name of an object.

You need to call this function after making changes to attributes in order to have getName() return the correct hash.

Definition at line 126 of file git_object.class.php.

GitObject::serialize (  ) 

Get the string representation of an object.

Returns:
The serialized representation of the object, as it would be stored by git.

Definition at line 115 of file git_object.class.php.

GitObject::unserialize ( data  ) 

Populate this object with values from its string representation.

Note that the types of $this and the serialized object in $data have to match.

Parameters:
$data (string) The serialized representation of an object, as it would be stored by git.

Definition at line 103 of file git_object.class.php.

GitObject::write (  ) 

Write this object in its serialized form to the git repository given at creation time.

Definition at line 135 of file git_object.class.php.


Member Data Documentation

GitObject::$name = NULL [protected]

Definition at line 28 of file git_object.class.php.

GitObject::$repo

(Git) The repository this object belongs to.

Definition at line 26 of file git_object.class.php.

GitObject::$type [protected]

Definition at line 27 of file git_object.class.php.


The documentation for this class was generated from the following file:

Generated on Sun May 31 19:50:30 2009 for glip by  doxygen 1.5.9