merge() public method

Existing styles are preserved.
public merge ( array $styles )
$styles array The styles to add.
Esempio n. 1
0
 public function testMerge()
 {
     $styleSet = new StyleSet();
     $styleSet->add($style1 = Style::tag('style1')->fgBlue());
     $styleSet->merge(array($style2 = Style::tag('style2')->bgMagenta(), $style3 = Style::tag('style3')->bold()));
     $this->assertSame(array('style1' => $style1, 'style2' => $style2, 'style3' => $style3), $styleSet->toArray());
 }
Esempio n. 2
0
 /**
  * Adds multiple styles to the style set.
  *
  * @param Style[] $styles The styles to add.
  *
  * @return static The current instance.
  *
  * @see StyleSet::merge()
  */
 public function addStyles(array $styles)
 {
     if (!$this->styleSet) {
         $this->styleSet = new DefaultStyleSet();
     }
     $this->styleSet->merge($styles);
     return $this;
 }