public function testGetMethods() { $style = new Style('BLACK', 'WHITE', array('BOLD' => true)); $this->assertEquals('BLACK', $style->getForeground()); $this->assertEquals('WHITE', $style->getBackground()); $this->assertEquals(array('BOLD' => true), $style->getOptions()); }
/** * Retrieves the ANSI string representation of requested color name * * @param Style $style Style * @return string */ protected function _getForegroundString(Style $style) { $foreground = $style->getForeground(); if (empty($foreground)) { return ''; } $str = chr(27) . '[' . $this->_getOptionsString($style); switch (strtoupper($foreground)) { case 'BLACK': return $str . '30m'; case 'RED': return $str . '31m'; case 'GREEN': return $str . '32m'; case 'YELLOW': return $str . '33m'; case 'BLUE': return $str . '34m'; case 'MAGENTA': return $str . '35m'; case 'CYAN': return $str . '36m'; case 'WHITE': return $str . '37m'; case 'DEFAULT_FGU': return $str . '38m'; case 'DEFAULT': default: return $str . '39m'; } }