Move git objects with load strategies into their own directories
[gitphp.git] / include / git / blob / BlobLoad_Git.class.php
blob:a/include/git/blob/BlobLoad_Git.class.php -> blob:b/include/git/blob/BlobLoad_Git.class.php
--- a/include/git/blob/BlobLoad_Git.class.php
+++ b/include/git/blob/BlobLoad_Git.class.php
@@ -5,30 +5,10 @@
  * @author Christopher Han <xiphux@gmail.com>
  * @copyright Copyright (c) 2012 Christopher Han
  * @package GitPHP
- * @subpackage Git
+ * @subpackage Git\Blob
  */
-class GitPHP_BlobLoad_Git implements GitPHP_BlobLoadStrategy_Interface
+class GitPHP_BlobLoad_Git extends GitPHP_BlobLoad_Base
 {
-	/**
-	 * Executable
-	 *
-	 * @var GitPHP_GitExe
-	 */
-	protected $exe;
-
-	/**
-	 * Constructor
-	 *
-	 * @param GitPHP_GitExe $exe executable
-	 */
-	public function __construct($exe)
-	{
-		if (!$exe)
-			throw new Exception('Git exe is required');
-
-		$this->exe = $exe;
-	}
-
 	/**
 	 * Gets the data for a blob
 	 *
@@ -40,11 +20,19 @@
 		if (!$blob)
 			return;
 
-		$args = array();
-		$args[] = 'blob';
-		$args[] = $blob->GetHash();
+		$result = $this->exe->GetObjectData($blob->GetProject()->GetPath(), $blob->GetHash());
+		return $result['contents'];
+	}
 
-		return $this->exe->Execute($blob->GetProject()->GetPath(), GIT_CAT_FILE, $args);
+	/**
+	 * Gets the size of a blob
+	 *
+	 * @param GitPHP_Blob $blob blob
+	 * @return int blob size
+	 */
+	public function Size($blob)
+	{
+		return $this->LoadSize($blob);
 	}
 }
 

comments