59 public function run($package, $installed =
false)
61 $showAllPackages = !$installed;
62 $commandParameters = [
64 'package' => $package,
66 '--all' => $showAllPackages,
70 $output = $this->magentoComposerApplication->runComposerCommand($commandParameters);
71 }
catch (\RuntimeException $e) {
75 $rawLines = explode(
"\n", str_replace(
"\r\n",
"\n",
$output));
78 foreach ($rawLines as $line) {
79 $chunk = explode(
':', $line);
80 if (count($chunk) === 2) {
81 $result[trim($chunk[0])] = trim($chunk[1]);
87 if (!isset(
$result[self::NAME]) && isset(
$result[self::CURRENT_VERSION])) {
100 private function extractVersions($packageInfo)
102 $versions = explode(
', ', $packageInfo[self::VERSIONS]);
106 if (count($versions) === 1) {
109 $currentVersion = array_values(preg_grep(
"/^\*.*/", $versions));
110 if ($currentVersion) {
119 if (count($packageInfo[self::AVAILABLE_VERSIONS]) > 0) {
120 if ($packageInfo[self::CURRENT_VERSION]) {
121 foreach ($packageInfo[self::AVAILABLE_VERSIONS] as
$version) {
122 if (version_compare($packageInfo[self::CURRENT_VERSION],
$version,
'<')) {
run($package, $installed=false)
$magentoComposerApplication
__construct(MagentoComposerApplication $magentoComposerApplication)