public function addTextStyle(string $style)
    {
        if (!isset(self::$supportedTextStyles[$style])) {
            throw new InvalidArgumentException("Invalid text style \"$style\"");
        }

        // Don't double-add a style
        if (!in_array($style, $this->textStyles)) {
            $this->textStyles[] = $style;
        }
    }
public function addTextStyle(string $style)
    {
        if (!isset(self::$supportedTextStyles[$style])) {
            throw new InvalidArgumentException("Invalid text style \"$style\"");
        }

        // Don't double-add a style
        if (!in_array($style, $this->textStyles)) {
            $this->textStyles[] = $style;
        }
    }
public function addTextStyle ( string $ style ) { if ( ! isset ( self :: $ supportedTextStyles [ $ style ] ) ) { throw new InvalidArgumentException ( "Invalid text style \"$style\"" ) ; } // Don't double-add a style if ( ! in_array ( $ style , $ this -> textStyles ) ) { $ this -> textStyles [ ] = $ style ; } }
Adds the text to have a certain style

@param string $style The name of the text style
@throws InvalidArgumentException Thrown if the text style does not exist
Adds the text to have a certain style