Skip to content

Commit

Permalink
Update MatrixListener.php
Browse files Browse the repository at this point in the history
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
  • Loading branch information
ghostwriter committed Jan 17, 2023
1 parent aecdccc commit 232ea82
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/Listener/MatrixListener.php
Expand Up @@ -9,6 +9,7 @@
use Ghostwriter\Compliance\Event\MatrixEvent;
use Ghostwriter\Compliance\Option\ComposerDependency;
use Ghostwriter\Compliance\Option\Job;
use Ghostwriter\Compliance\Option\PhpVersion;
use Ghostwriter\Compliance\Option\Tool;
use Ghostwriter\Container\Container;
use Throwable;
Expand All @@ -30,21 +31,23 @@ public function __construct(
*/
public function __invoke(MatrixEvent $generateMatrixEvent): void
{
$phpVersions = [PhpVersion::CURRENT_STABLE, PhpVersion::CURRENT_LATEST];
/** @var ToolInterface $tool */
foreach ($this->container->tagged(Tool::class) as $tool) {
if ($tool->isPresent()) {
/** @var int $phpVersion */
$phpVersion = $this->container->get(ComposerDependency::CONFIG . '.php');
foreach (self::DEPENDENCIES as $dependency) {
if ('latest' === $dependency) {
$generateMatrixEvent->include(
new Job($tool->name(), $tool->command(), $dependency, $phpVersion)
);

foreach ($phpVersions as $phpVersion) {
foreach (self::DEPENDENCIES as $dependency) {
if ('latest' === $dependency) {
$generateMatrixEvent->include(
new Job($tool->name(), $tool->command(), $dependency, $phpVersion)
);
}
// Todo: support including/excluding $dependency
// $generateMatrixEvent->include(
// new Job($tool->name(), $tool->command(), $dependency, $phpVersion)
// );
}
// Todo: support including/excluding $dependency
// $generateMatrixEvent->include(
// new Job($tool->name(), $tool->command(), $dependency, $phpVersion)
// );
}
}
}
Expand Down

0 comments on commit 232ea82

Please sign in to comment.