Webmozart\Console\Api\Formatter\StyleSet::add PHP Méthode

add() public méthode

Adds a style.
public add ( Style $style )
$style Style The style to add.
    public function add(Style $style)
    {
        if (!$style->getTag()) {
            throw new LogicException('The tag of a style added to the style set must be set.');
        }
        $this->styles[$style->getTag()] = $style;
    }

Usage Example

 /**
  * Adds a style to the style set.
  *
  * @param Style $style The style to add.
  *
  * @return static The current instance.
  *
  * @see StyleSet::add()
  */
 public function addStyle(Style $style)
 {
     if (!$this->styleSet) {
         $this->styleSet = new DefaultStyleSet();
     }
     $this->styleSet->add($style);
     return $this;
 }
All Usage Examples Of Webmozart\Console\Api\Formatter\StyleSet::add