Cleanup unused variables
Cleanup unused variables

--- a/include/controller/ControllerBase.class.php
+++ b/include/controller/ControllerBase.class.php
@@ -176,7 +176,6 @@
 			 * User's first time here, try by HTTP_ACCEPT_LANGUAGE
 			 */
 			if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
-				$httpAcceptLang = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
 				$locale = GitPHP_Resource::FindPreferredLocale($_SERVER['HTTP_ACCEPT_LANGUAGE']);
 				if (!empty($locale)) {
 					setcookie(GitPHP_Resource::LocaleCookie, $locale, time()+GitPHP_Resource::LocaleCookieLifetime, $baseurl);

--- a/include/controller/Controller_Feed.class.php
+++ b/include/controller/Controller_Feed.class.php
@@ -106,7 +106,7 @@
 	 */
 	protected function LoadData()
 	{
-		$compat = $this->GetProject()->GetCompat();
+		//$compat = $this->GetProject()->GetCompat();
 		$strategy = null;
 		//if ($compat) {
 			$strategy = new GitPHP_LogLoad_Git($this->exe);

--- a/include/controller/Controller_Log.class.php
+++ b/include/controller/Controller_Log.class.php
@@ -77,7 +77,7 @@
 		$this->tpl->assign('head', $this->GetProject()->GetHeadCommit());
 		$this->tpl->assign('page',$this->params['page']);
 
-		$compat = $this->GetProject()->GetCompat();
+		//$compat = $this->GetProject()->GetCompat();
 		$skip = $this->params['page'] * 100;
 		$strategy = null;
 		//if ($compat || ($skip > $this->config->GetValue('largeskip'))) {

--- a/include/controller/Controller_Project.class.php
+++ b/include/controller/Controller_Project.class.php
@@ -54,7 +54,7 @@
 		if (!$head)
 			$this->tpl->assign('enablesearch', false);
 
-		$compat = $this->GetProject()->GetCompat();
+		//$compat = $this->GetProject()->GetCompat();
 		$strategy = null;
 		//if ($compat) {
 			$strategy = new GitPHP_LogLoad_Git($this->exe);

--- a/include/controller/Controller_Snapshot.class.php
+++ b/include/controller/Controller_Snapshot.class.php
@@ -23,13 +23,6 @@
 	 * @var string
 	 */
 	private $cacheDir = null;
-
-	/**
-	 * Snapshot cached file path
-	 *
-	 * @var string
-	 */
-	private $cachedFile;
 
 	/**
 	 * Initialize controller

--- a/include/git/FileSearch.class.php
+++ b/include/git/FileSearch.class.php
@@ -428,11 +428,10 @@
 		}
 
 		$pos = 0;
-		$count = 0;
 
 		$this->resultList = array();
 
-		foreach ($this->allResults as $path => $result) {
+		foreach ($this->allResults as $result) {
 
 			if ($pos++ < $this->skip)
 				continue;

--- a/include/git/FilesystemObject.class.php
+++ b/include/git/FilesystemObject.class.php
@@ -223,7 +223,7 @@
 			if (isset($data['hash']) && !empty($data['hash'])) {
 				$tree = $this->GetProject()->GetObjectManager()->GetTree($data['hash']);
 				if (isset($usedTrees[$data['hash']])) {
-					$tree = clone $obj;
+					$tree = clone $tree;
 				} else {
 					$usedTrees[$data['hash']] = 1;
 				}

--- a/include/git/GitExe.class.php
+++ b/include/git/GitExe.class.php
@@ -328,7 +328,7 @@
 			return false;
 
 		$code = 0;
-		$out = exec($this->binary . ' --version', $tmp, $code);
+		exec($this->binary . ' --version', $tmp, $code);
 
 		return $code == 0;
 	}

--- a/include/git/GitObjectLoader.class.php
+++ b/include/git/GitObjectLoader.class.php
@@ -70,20 +70,21 @@
 		$path = $this->project->GetPath() . '/objects/' . substr($hash, 0, 2) . '/' . substr($hash, 2);
 		if (file_exists($path)) {
 			list($header, $data) = explode("\0", gzuncompress(file_get_contents($path)), 2);
-			sscanf($header, "%s %d", $typestr, $size);
-			switch ($typestr) {
-				case 'commit':
-					$type = GitPHP_Pack::OBJ_COMMIT;
-					break;
-				case 'tree':
-					$type = GitPHP_Pack::OBJ_TREE;
-					break;
-				case 'blob':
-					$type = GitPHP_Pack::OBJ_BLOB;
-					break;
-				case 'tag':
-					$type = GitPHP_Pack::OBJ_TAG;
-					break;
+			if (preg_match('/^([A-Za-z]+) /', $header, $typestr)) {
+				switch ($typestr[1]) {
+					case 'commit':
+						$type = GitPHP_Pack::OBJ_COMMIT;
+						break;
+					case 'tree':
+						$type = GitPHP_Pack::OBJ_TREE;
+						break;
+					case 'blob':
+						$type = GitPHP_Pack::OBJ_BLOB;
+						break;
+					case 'tag':
+						$type = GitPHP_Pack::OBJ_TAG;
+						break;
+				}
 			}
 			return $data;
 		}
@@ -165,7 +166,7 @@
 		for ($len = strlen($prefix)+1; $len < 40; $len++) {
 			$prefix = substr($hash, 0, $len);
 
-			foreach ($hashMap as $matchingHash => $val) {
+			foreach (array_keys($hashMap) as $matchingHash) {
 				if (substr_compare($matchingHash, $prefix, 0, $len) !== 0) {
 					unset($hashMap[$matchingHash]);
 				}

--- a/include/git/pack/PackData.class.php
+++ b/include/git/pack/PackData.class.php
@@ -212,8 +212,8 @@
 		 * algorithm from patch-delta.c
 		 */
 		$pos = 0;
-		$baseSize = GitPHP_PackData::ParseVarInt($delta, $pos);
-		$resultSize = GitPHP_PackData::ParseVarInt($delta, $pos);
+		GitPHP_PackData::ParseVarInt($delta, $pos);	// base size
+		GitPHP_PackData::ParseVarInt($delta, $pos);	// result size
 
 		$data = '';
 		$deltalen = strlen($delta);

--- a/include/git/pack/PackIndexReaderV1.class.php
+++ b/include/git/pack/PackIndexReaderV1.class.php
@@ -80,7 +80,7 @@
 
 		fseek($index, 4*256 + 24*$low);
 		for ($i = 0; $i < $range; $i++) {
-			$off = GitPHP_Pack::fuint32($index);
+			GitPHP_Pack::fuint32($index);	// offset
 			$binName = fread($index, 20);
 			$name = bin2hex($binName);
 

--- a/include/git/projectlist/ProjectListArrayLegacy.class.php
+++ b/include/git/projectlist/ProjectListArrayLegacy.class.php
@@ -39,9 +39,9 @@
 	 */
 	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->LoadProject($ppath);
 						if ($projObj) {

--- a/include/git/tag/TagLoad_Raw.class.php
+++ b/include/git/tag/TagLoad_Raw.class.php
@@ -74,7 +74,7 @@
 		$objectHash = null;
 
 		$readInitialData = false;
-		foreach ($lines as $i => $line) {
+		foreach ($lines as $line) {
 			if (!$readInitialData) {
 				if (preg_match('/^object ([0-9a-fA-F]{40})$/', $line, $regs)) {
 					$objectHash = $regs[1];

--- a/include/router/Router.class.php
+++ b/include/router/Router.class.php
@@ -725,7 +725,7 @@
 	{
 		if ($value instanceof GitPHP_Project) {
 			return $value->GetProject();
-		} else if (is_string($project)) {
+		} else if (is_string($value)) {
 			return $value;
 		}
 	}

comments