Browse Source

Add IOInterface methods

Jordi Boggiano 5 years ago
parent
commit
a6176a7beb
2 changed files with 21 additions and 11 deletions
  1. 18 0
      src/Composer/IO/IOInterface.php
  2. 3 11
      src/Composer/Util/ProcessExecutor.php

+ 18 - 0
src/Composer/IO/IOInterface.php

@@ -81,6 +81,24 @@ interface IOInterface extends LoggerInterface
      */
     public function writeError($messages, $newline = true, $verbosity = self::NORMAL);
 
+    /**
+     * Writes a message to the output, without formatting it.
+     *
+     * @param string|array $messages  The message as an array of lines or a single string
+     * @param bool         $newline   Whether to add a newline or not
+     * @param int          $verbosity Verbosity level from the VERBOSITY_* constants
+     */
+    public function writeRaw($messages, $newline = true, $verbosity = self::NORMAL);
+
+    /**
+     * Writes a message to the error output, without formatting it.
+     *
+     * @param string|array $messages  The message as an array of lines or a single string
+     * @param bool         $newline   Whether to add a newline or not
+     * @param int          $verbosity Verbosity level from the VERBOSITY_* constants
+     */
+    public function writeErrorRaw($messages, $newline = true, $verbosity = self::NORMAL);
+
     /**
      * Overwrites a previous message to the output.
      *

+ 3 - 11
src/Composer/Util/ProcessExecutor.php

@@ -112,18 +112,10 @@ class ProcessExecutor
             return;
         }
 
-        if (method_exists($this->io, 'writeRaw')) {
-            if (Process::ERR === $type) {
-                $this->io->writeErrorRaw($buffer, false);
-            } else {
-                $this->io->writeRaw($buffer, false);
-            }
+        if (Process::ERR === $type) {
+            $this->io->writeErrorRaw($buffer, false);
         } else {
-            if (Process::ERR === $type) {
-                $this->io->writeError($buffer, false);
-            } else {
-                $this->io->write($buffer, false);
-            }
+            $this->io->writeRaw($buffer, false);
         }
     }