Use autoloading to load class files
[gitphp.git] / include / git / projectlist / ProjectListArrayLegacy.class.php
blob:a/include/git/projectlist/ProjectListArrayLegacy.class.php -> blob:b/include/git/projectlist/ProjectListArrayLegacy.class.php
--- a/include/git/projectlist/ProjectListArrayLegacy.class.php
+++ b/include/git/projectlist/ProjectListArrayLegacy.class.php
@@ -1,36 +1,27 @@
 <?php
 /**
- * GitPHP ProjectListArrayLegacy
- *
- * Lists all projects in a multidimensional array
- * Legacy array format
+ * Lists all projects in a multidimensional array (Legacy array format)
  *
  * @author Christopher Han <xiphux@gmail.com>
  * @copyright Copyright (c) 2010 Christopher Han
  * @package GitPHP
- * @subpackage Git
- */
-
-define('GITPHP_NO_CATEGORY', 'none');
-
-/**
- * ProjectListArrayLegacy class
- *
- * @package GitPHP
- * @subpackage Git
+ * @subpackage Git\ProjectList
  */
 class GitPHP_ProjectListArrayLegacy extends GitPHP_ProjectListBase
 {
+	/**
+	 * No category indicator
+	 *
+	 * @var string
+	 */
+	const NoCategory = 'none';
 
 	/**
-	 * __construct
-	 *
 	 * constructor
 	 *
 	 * @param string $projectRoot project root
 	 * @param mixed $projectArray array to read
 	 * @throws Exception if parameter is not an array
-	 * @access public
 	 */
 	public function __construct($projectRoot, $projectArray)
 	{
@@ -44,26 +35,21 @@
 	}
 
 	/**
-	 * PopulateProjects
-	 *
 	 * Populates the internal list of projects
-	 *
-	 * @access protected
-	 * @throws Exception if file cannot be read
 	 */
 	protected function PopulateProjects()
 	{
-		foreach ($this->projectConfig as $cat => $plist) {
+		foreach ($this->projectConfig as $plist) {
 			if (is_array($plist)) {
-				foreach ($plist as $pname => $ppath) {
+				foreach ($plist as $ppath) {
 					try {
-						$projObj = $this->InstantiateProject($ppath);
+						$projObj = $this->LoadProject($ppath);
 						if ($projObj) {
 							$this->projects[$ppath] = $projObj;
 							unset($projObj);
 						}
 					} catch (Exception $e) {
-						GitPHP_DebugLog::GetInstance()->Log($e->getMessage());
+						$this->Log('Project error', $e->getMessage());
 					}
 				}
 			}
@@ -71,18 +57,15 @@
 	}
 
 	/**
-	 * InstantiateProject
+	 * Loads a project
 	 *
-	 * Instantiates project object
-	 *
-	 * @access protected
 	 * @param string $proj project
-	 * @return mixed project
+	 * @return GitPHP_Project project
 	 */
-	protected function InstantiateProject($proj)
+	protected function LoadProject($proj)
 	{
 		$found = false;
-		$projectCat = GITPHP_NO_CATEGORY;
+		$projectCat = GitPHP_ProjectListArrayLegacy::NoCategory;
 		foreach ($this->projectConfig as $cat => $plist) {
 			if (is_array($plist) && (array_search($proj, $plist) !== false)) {
 				$found = true;
@@ -101,8 +84,10 @@
 
 		$this->ApplyGitConfig($projectObj);
 
-		if ($projectCat != GITPHP_NO_CATEGORY)
+		if ($projectCat != GitPHP_ProjectListArrayLegacy::NoCategory)
 			$projectObj->SetCategory($projectCat);
+
+		$this->InjectProjectDependencies($projectObj);
 
 		return $projectObj;
 	}

comments