Пример #1
0
 public function testBooleanWillBeColoredWhenAThemeIsSpecified()
 {
     $theme = $this->getThemeForValue(array('value.boolean' => 'red'));
     $this->renderer->setTheme($theme);
     $c = new Color();
     $this->assertString($this->renderer->render(true))->contains((string) $c('true')->red);
 }
Пример #2
0
 /**
  * @param string $syntax
  * @param array  $data
  * @return string
  */
 public function render($syntax, array $data = array())
 {
     ArgumentChecker::check($syntax, 'string');
     $renderer = new ValueRenderer();
     if (self::$color) {
         $renderer->setTheme(new DefaultTheme());
     }
     return preg_replace_callback('/\\?/', function () use(&$data, $renderer) {
         $r = $renderer->render(array_shift($data));
         return $r;
     }, $syntax);
 }