This repository has been archived by the owner on Dec 3, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MB] Decouple ConflictingPackageVersionsReporter
- Loading branch information
1 parent
b08d8e4
commit dfd5d42
Showing
3 changed files
with
52 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
packages/MonorepoBuilder/src/Console/Reporter/ConflictingPackageVersionsReporter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Symplify\MonorepoBuilder\Console\Reporter; | ||
|
||
use Symfony\Component\Console\Style\SymfonyStyle; | ||
|
||
final class ConflictingVersionsReporter | ||
{ | ||
/** | ||
* @var SymfonyStyle | ||
*/ | ||
private $symfonyStyle; | ||
|
||
public function __construct(SymfonyStyle $symfonyStyle) | ||
{ | ||
$this->symfonyStyle = $symfonyStyle; | ||
} | ||
|
||
/** | ||
* @param mixed[] $conflictingPackages | ||
*/ | ||
public function reportConflictingPackages(array $conflictingPackages): void | ||
{ | ||
foreach ($conflictingPackages as $packageName => $filesToVersions) { | ||
$tableData = []; | ||
foreach ($filesToVersions as $file => $version) { | ||
$tableData[] = [$file, $version]; | ||
} | ||
|
||
$this->symfonyStyle->title(sprintf('Package "%s" has various version', $packageName)); | ||
$this->symfonyStyle->table(['File', 'Version'], $tableData); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters