Class RequireUpdateDryRunCommand calls composer require and update –dry-run commands
Definition at line 12 of file RequireUpdateDryRunCommand.php.
◆ __construct()
◆ explodePackagesAndVersions()
explodePackagesAndVersions |
( |
|
$packages | ) |
|
|
protected |
Returns array that contains package as key and version as value
- Parameters
-
- Returns
- array
Definition at line 143 of file RequireUpdateDryRunCommand.php.
145 $packagesAndVersions = [];
146 foreach ($packages as $package) {
147 $package = explode(
' ', $package);
148 $packagesAndVersions[$package[0]] = $package[1];
151 return $packagesAndVersions;
◆ generateAdditionalErrorMessage()
generateAdditionalErrorMessage |
( |
|
$message, |
|
|
|
$inputPackages |
|
) |
| |
|
protected |
Generates additional explanation for error message
- Parameters
-
array | $message | |
array | $inputPackages | |
- Returns
- string
Definition at line 79 of file RequireUpdateDryRunCommand.php.
84 $rawLines = explode(PHP_EOL,
$message);
86 foreach ($rawLines as $line) {
87 if (preg_match(
'/- (.*) requires (.*) -> no matching package/', $line, $matches)) {
88 $packages[] = $matches[1];
89 $packages[] = $matches[2];
93 if (!empty($packages)) {
94 $packages = array_unique($packages);
101 foreach ($inputPackages as $package =>
$version) {
102 if (isset($packages[$package])) {
103 $update[] = $package .
' to ' .
$version;
107 foreach (array_diff_key($packages, $inputPackages) as $package =>
$version) {
109 if (!$packageInfo = $this->infoCommand->run($package,
true)) {
116 $packageInfo = $this->infoCommand->run($package);
122 $conflicts[] =
' - ' . $package .
' version ' . $currentVersion .
'. ' 123 .
'Please try to update it to one of the following package versions: ' 124 . implode(
', ', $packageInfo[
'available_versions']);
127 $errorMessage =
'You are trying to update package(s) ' 128 . implode(
', ', $update) . PHP_EOL
129 .
"We've detected conflicts with the following packages:" . PHP_EOL
130 . implode(PHP_EOL, $conflicts)
134 return $errorMessage;
explodePackagesAndVersions($packages)
◆ run()
run |
( |
|
$packages, |
|
|
|
$workingDir = null |
|
) |
| |
Runs composer update –dry-run command
- Parameters
-
array | $packages | |
string | null | $workingDir | |
- Returns
- string
- Exceptions
-
Definition at line 46 of file RequireUpdateDryRunCommand.php.
50 $this->magentoComposerApplication->runComposerCommand(
51 [
'command' =>
'require',
'packages' => $packages,
'--no-update' =>
true],
55 $output = $this->magentoComposerApplication->runComposerCommand(
56 [
'command' =>
'update',
'--dry-run' =>
true],
59 }
catch (\RuntimeException $e) {
62 throw new \RuntimeException($errorMessage, $e->getCode(), $e);
64 throw new \RuntimeException($e->getMessage(), $e->getCode(), $e);
generateAdditionalErrorMessage($message, $inputPackages)
◆ $infoCommand
◆ $magentoComposerApplication
$magentoComposerApplication |
|
protected |
The documentation for this class was generated from the following file: