1.0.0 Alpha Release #59

Merged
netkas merged 213 commits from v1.0.0_alpha into master 2023-01-29 23:27:58 +00:00
3 changed files with 40 additions and 2 deletions
Showing only changes of commit 24077691bb - Show all commits

View file

@ -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)

View file

@ -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
* *

View file

@ -118,7 +118,7 @@
{ {
if($dep->Name == $dependency->Name) if($dep->Name == $dependency->Name)
{ {
$this->removeDependency($dep); $this->removeDependency($dep->Name);
break; break;
} }
} }