فهرست منبع

we need ability to get style parameters same way we set them with setStyle

from last privatisation update $styles now private. So,
user can set style with public setter (setStyle), but can't
get this value later, which is very stupid behavior!
ever.zet 14 سال پیش
والد
کامیت
49b968df67
1فایلهای تغییر یافته به همراه16 افزوده شده و 0 حذف شده
  1. 16 0
      src/Symfony/Component/Console/Output/Output.php

+ 16 - 0
src/Symfony/Component/Console/Output/Output.php

@@ -68,6 +68,22 @@ abstract class Output implements OutputInterface
         self::$styles[strtolower($name)] = $options;
     }
 
+    /**
+     * Gets style options from style with specified name.
+     *
+     * @param   string  $name
+     *
+     * @return  array
+     */
+    static public function getStyle($name)
+    {
+        if (!isset(self::$styles[strtolower($name)])) {
+            throw new \InvalidArgumentException('Undefined style: ' . $name);
+        }
+
+        return self::$styles[strtolower($name)];
+    }
+
     /**
      * Sets the decorated flag.
      *