Bug fix: Duplicate dependencies
This commit is contained in:
parent
570b21ca3d
commit
24077691bb
3 changed files with 40 additions and 2 deletions
|
@ -250,7 +250,7 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->package->Dependencies[] = $dependency;
|
$this->package->addDependency($dependency);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($this->package->Dependencies) > 0)
|
if(count($this->package->Dependencies) > 0)
|
||||||
|
|
|
@ -103,6 +103,44 @@
|
||||||
$this->Resources = [];
|
$this->Resources = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a dependency to the package
|
||||||
|
*
|
||||||
|
* @param Dependency $dependency
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function addDependency(Dependency $dependency)
|
||||||
|
{
|
||||||
|
foreach($this->Dependencies as $dep)
|
||||||
|
{
|
||||||
|
if($dep->Name == $dependency->Name)
|
||||||
|
{
|
||||||
|
$this->removeDependency($dep->Name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->Dependencies[] = $dependency;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a dependency from the build
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function removeDependency(string $name)
|
||||||
|
{
|
||||||
|
foreach($this->Dependencies as $key => $dep)
|
||||||
|
{
|
||||||
|
if($dep->Name == $name)
|
||||||
|
{
|
||||||
|
unset($this->Dependencies[$key]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validates the package object and returns True if the package contains the correct information
|
* Validates the package object and returns True if the package contains the correct information
|
||||||
*
|
*
|
||||||
|
|
|
@ -118,7 +118,7 @@
|
||||||
{
|
{
|
||||||
if($dep->Name == $dependency->Name)
|
if($dep->Name == $dependency->Name)
|
||||||
{
|
{
|
||||||
$this->removeDependency($dep);
|
$this->removeDependency($dep->Name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue