ソースを参照

Fix undef variable in search, fixes #374

Jordi Boggiano 13 年 前
コミット
30f612f672
1 ファイル変更8 行追加2 行削除
  1. 8 2
      src/Composer/Command/SearchCommand.php

+ 8 - 2
src/Composer/Command/SearchCommand.php

@@ -62,12 +62,18 @@ EOT
                     continue;
                 }
 
-                $state = $localRepo->hasPackage($package) ? '<info>installed</info>' : $state = '<comment>available</comment>';
+                if ($platformRepo->hasPackage($package)) {
+                    $type = '<info>platform: </info> ';
+                } elseif ($installedRepo->hasPackage($package)) {
+                    $type = '<info>installed:</info> ';
+                } else {
+                    $type = '<comment>available:</comment> ';
+                }
 
                 $name = substr($package->getPrettyName(), 0, $pos)
                     . '<highlight>' . substr($package->getPrettyName(), $pos, strlen($token)) . '</highlight>'
                     . substr($package->getPrettyName(), $pos + strlen($token));
-                $output->writeln($state . ': ' . $name . ' <comment>' . $package->getPrettyVersion() . '</comment>');
+                $output->writeln($type . ': ' . $name . ' <comment>' . $package->getPrettyVersion() . '</comment>');
                 continue 2;
             }
         }