Skip to content

Commit

Permalink
Extract values instead of filter files
Browse files Browse the repository at this point in the history
  • Loading branch information
sebprt committed Oct 6, 2023
1 parent ddb8ae7 commit 13c55cb
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions src/Adapter/Docker/Satellite.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ public function dependsOn(string ...$dependencies): self
public function build(
LoggerInterface $logger,
): void {
$this->sortFiles();
$archive = new TarArchive($this->dockerfile, ...$this->files);
$archive = new TarArchive($this->dockerfile, ...array_values($this->files));

$iterator = function (iterable $tags) {
foreach ($tags as $tag) {
Expand Down Expand Up @@ -86,21 +85,4 @@ public function build(
throw new \RuntimeException('Process exited unexpectedly.');
}
}

private function sortFiles(): void
{
uksort($this->files, function ($a, $b) {
if (is_numeric($a) && is_numeric($b)) {
return $a - $b;
}
if (is_numeric($a)) {
return -1;
}
if (is_numeric($b)) {
return 1;
}

return strcmp($a, $b);
});
}
}

0 comments on commit 13c55cb

Please sign in to comment.