瀏覽代碼

[Console] moved Output constants to OutputInterface

Fabien Potencier 14 年之前
父節點
當前提交
49d67645d7

+ 1 - 1
src/Symfony/Bundle/FrameworkBundle/Command/RouterApacheDumperCommand.php

@@ -65,6 +65,6 @@ EOF
 
         $dumper = new ApacheMatcherDumper($router->getRouteCollection());
 
-        $output->writeln($dumper->dump($dumpOptions), Output::OUTPUT_RAW);
+        $output->writeln($dumper->dump($dumpOptions), OutputInterface::OUTPUT_RAW);
     }
 }

+ 1 - 1
src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php

@@ -134,7 +134,7 @@ EOF
         }
         $output->writeln(sprintf('<comment>Options</comment>      %s', $options));
         $output->write('<comment>Regex</comment>        ');
-        $output->writeln(preg_replace('/^             /', '', preg_replace('/^/m', '             ', $route->getRegex())), Output::OUTPUT_RAW);
+        $output->writeln(preg_replace('/^             /', '', preg_replace('/^/m', '             ', $route->getRegex())), OutputInterface::OUTPUT_RAW);
 
         $tokens = '';
         foreach ($route->getTokens() as $token) {

+ 3 - 3
src/Symfony/Component/Console/Application.php

@@ -170,9 +170,9 @@ class Application
         }
 
         if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
-            $output->setVerbosity(Output::VERBOSITY_QUIET);
+            $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
         } elseif (true === $input->hasParameterOption(array('--verbose', '-v'))) {
-            $output->setVerbosity(Output::VERBOSITY_VERBOSE);
+            $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
         }
 
         if (true === $input->hasParameterOption(array('--version', '-V'))) {
@@ -723,7 +723,7 @@ class Application
             }
             $output->writeln("\n");
 
-            if (Output::VERBOSITY_VERBOSE === $output->getVerbosity()) {
+            if (OutputInterface::VERBOSITY_VERBOSE === $output->getVerbosity()) {
                 $output->writeln('</comment>Exception trace:</comment>');
 
                 // exception related properties

+ 1 - 1
src/Symfony/Component/Console/Command/HelpCommand.php

@@ -74,7 +74,7 @@ EOF
         }
 
         if ($input->getOption('xml')) {
-            $output->writeln($this->command->asXml(), Output::OUTPUT_RAW);
+            $output->writeln($this->command->asXml(), OutputInterface::OUTPUT_RAW);
         } else {
             $output->writeln($this->command->asText());
         }

+ 1 - 1
src/Symfony/Component/Console/Command/ListCommand.php

@@ -59,7 +59,7 @@ EOF
     protected function execute(InputInterface $input, OutputInterface $output)
     {
         if ($input->getOption('xml')) {
-            $output->writeln($this->getApplication()->asXml($input->getArgument('namespace')), Output::OUTPUT_RAW);
+            $output->writeln($this->getApplication()->asXml($input->getArgument('namespace')), OutputInterface::OUTPUT_RAW);
         } else {
             $output->writeln($this->getApplication()->asText($input->getArgument('namespace')));
         }

+ 3 - 3
src/Symfony/Component/Console/Output/Output.php

@@ -168,12 +168,12 @@ abstract class Output implements OutputInterface
 
         foreach ($messages as $message) {
             switch ($type) {
-                case Output::OUTPUT_NORMAL:
+                case OutputInterface::OUTPUT_NORMAL:
                     $message = $this->formatter->format($message);
                     break;
-                case Output::OUTPUT_RAW:
+                case OutputInterface::OUTPUT_RAW:
                     break;
-                case Output::OUTPUT_PLAIN:
+                case OutputInterface::OUTPUT_PLAIN:
                     $message = strip_tags($this->formatter->format($message));
                     break;
                 default:

+ 8 - 0
src/Symfony/Component/Console/Output/OutputInterface.php

@@ -22,6 +22,14 @@ use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  */
 interface OutputInterface
 {
+    const VERBOSITY_QUIET   = 0;
+    const VERBOSITY_NORMAL  = 1;
+    const VERBOSITY_VERBOSE = 2;
+
+    const OUTPUT_NORMAL = 0;
+    const OUTPUT_RAW = 1;
+    const OUTPUT_PLAIN = 2;
+
     /**
      * Writes a message to the output.
      *