lithium\console\Response::styles PHP Method

styles() public method

Handles styling output.
public styles ( array | boolean $styles = [] ) : array
$styles array | boolean
return array
    public function styles($styles = array())
    {
        $defaults = array('end' => "", 'black' => "", 'red' => "", 'green' => "", 'yellow' => "", 'blue' => "", 'purple' => "", 'cyan' => "", 'white' => "", 'heading' => "", 'option' => "", 'command' => "", 'error' => "", 'success' => "", 'bold' => "");
        if ($styles === false) {
            return array_combine(array_keys($defaults), array_pad(array(), count($defaults), null));
        }
        $styles += $defaults;
        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
            return $this->styles(false);
        }
        return $styles;
    }

Usage Example

Example #1
0
 public function testStyledOutput()
 {
     $base = Libraries::get(true, 'resources') . '/tmp/tests';
     $this->skipIf(!is_writable($base), "Path `{$base}` is not writable.");
     $response = new Response(array('output' => fopen($this->streams['output'], 'w+')));
     $response->styles(array('heading' => ""));
     $response->output('{:heading}ok');
     $this->assertEqual("ok", file_get_contents($this->streams['output']));
 }
All Usage Examples Of lithium\console\Response::styles