/** * Creates a TextStyle from its textual representation. This is useful * to keep the syntax short and readable when working with text styles. * * @param string $string The textual representation * * @return Jm_Console_TextStyle * * @throws Jm_Console_TextStyleException if $string cannot be parsed * * @TODO examples */ public static function fromString($string) { return Jm_Console_TextStyleFactory::singleton()->createFromString($string); }
/** * @expectedException Exception */ public function testClone() { require_once 'Jm/Autoloader.php'; $factory = Jm_Console_TextStyleFactory::singleton(); clone $factory; }
/** * Sets the default text style. * * @param string|Jm_Console_TextStyle $style the value * * @return Jm_Console_Output * * @throws InvalidArgumentException if $style is not a string or a * Jm_Console_TextStyle */ public function setDefaultTextStyle($style) { if (is_string($style)) { $style = Jm_Console_TextStyleFactory::singleton()->createFromString($style); } if (!is_a($style, 'Jm_Console_TextStyle')) { throw new Exception(sprintf('$style eas expected to be a string. %s found', gettype($style))); } $this->defaultTextStyle = $style; return $this; }