|
|
@@ -14,6 +14,8 @@
|
|
|
*/
|
|
|
namespace Cake\Console;
|
|
|
|
|
|
+use InvalidArgumentException;
|
|
|
+
|
|
|
/**
|
|
|
* Object wrapper for outputting information from a shell application.
|
|
|
* Can be connected to any stream resource that can be used with fopen()
|
|
|
@@ -303,8 +305,35 @@ class ConsoleOutput
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Get the output type on how formatting tags are treated.
|
|
|
+ *
|
|
|
+ * @return int
|
|
|
+ */
|
|
|
+ public function getOutputAs()
|
|
|
+ {
|
|
|
+ return $this->_outputAs;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Set the output type on how formatting tags are treated.
|
|
|
+ *
|
|
|
+ * @param int $type The output type to use. Should be one of the class constants.
|
|
|
+ * @return void
|
|
|
+ * @throws \InvalidArgumentException in case of a not supported output type.
|
|
|
+ */
|
|
|
+ public function setOutputAs($type)
|
|
|
+ {
|
|
|
+ if (!in_array($type, [self::RAW, self::PLAIN, self::COLOR], true)) {
|
|
|
+ throw new InvalidArgumentException(sprintf('Invalid output type "%s".', $type));
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->_outputAs = $type;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Get/Set the output type to use. The output type how formatting tags are treated.
|
|
|
*
|
|
|
+ * @deprecated 3.5.0 Use getOutputAs()/setOutputAs() instead.
|
|
|
* @param int|null $type The output type to use. Should be one of the class constants.
|
|
|
* @return int|null Either null or the value if getting.
|
|
|
*/
|