Sets the chunk's current characters

@param  string[]  an array of characters
@return  self
@throws  InvalidArgumentException  if $characters is not an array of strings
@since  0.1.0
189255
public function setCharacters(Array $characters)
	{
		if (count($characters) !== count(array_filter($characters, 'is_string'))) {
			throw new \InvalidArgumentException(
				__METHOD__."() expects parameter one, characters, to be an array of "
					. "strings"
			);	
		}
		
		$this->characters = $characters;
		
		return $this;
	}
1019659
public static function valueOf($char): self
    {
        if (\is_string($char) || $char instanceof self) {
            return new static((string) $char);
        }

        throw new InvalidArgumentException('Unsupported character type!');
    }
846211
public function setTextBody($text) {
    if (!is_string($text)) {
      $error = sprintf("Plain text given is not a string (Actual type: %s).",
                       gettype($text));
      throw new \InvalidArgumentException($error);
    }
    $this->message->setTextbody($text);
  }
229155
public function setDelimiter(string $delimiter): self
    {
        if ($delimiter === $this->delimiter) {
            return $this;
        }

        if (1 === strlen($delimiter)) {
            $this->delimiter = $delimiter;
            $this->resetProperties();

            return $this;
        }

        throw new Exception(sprintf('%s() expects delimiter to be a single character %s given', __METHOD__, $delimiter));
    }
66013
public function sprintf(...$values): self
    {
        return new self(\sprintf($this->value, ...$values), $this->encoding);
    }
796905
public function arg(array $args, $char = "%")
  {
    $args = array_reverse($args, TRUE);

    foreach($args as $key => $val)
    {
      $args[$char . $key] = $val;
      unset($args[$key]);
    }

    $this->string = strtr($this->string, $args);

    return $this;
  }
1139254
protected function bufferize($char)
    {
        $buffer = $this->getBuffer();
        $buffer[] = $char;
        $this->setBuffer($buffer);
    }
1272468
public function setEncoding($encoding)
    {
        if (strlen($encoding) == 0) {
            throw new \InvalidArgumentException(sprintf('Encoding should not be empty'));
        }

        $this->encoding = $encoding;

        return $this;
    }
766758
public function setMethods(array $methods)
    {
        $methods = array_map('strtoupper', $methods);
        $diff = array_diff($methods, static::VALID_METHODS);
        if ($diff !== []) {
            throw new InvalidArgumentException(
                sprintf('Invalid HTTP method received. %s is invalid.', implode(', ', $diff))
            );
        }
        $this->defaults['_method'] = $methods;

        return $this;
    }
979871
public void characters(String characters) throws SAXException
    {
        final int len = characters.length();
        if (len > m_charsBuff.length)
        {
           m_charsBuff = new char[len*2 + 1];             
        }
        characters.getChars(0,len, m_charsBuff, 0);   
        characters(m_charsBuff, 0, len);
    }
339803
public function setValidChars(string $chars): self
	{
		$this->assertCharacterClass($chars);

		$this->validChars = $chars;
		$this->setOptions['validChars'] = null;

		return $this;
	}
744557
public function setArray(array $strings, $locale)
	{
		$localeObject = new Locale;
		$localeObject->setLocale($locale)
		             ->setStrings($strings);
		$this->locales[$locale] = $localeObject;
		return $this;
	}
756660
public function serializeStrings(array $strings)
	{
		$info         = $this->analyzeStrings($strings);
		$alternations = array_map([$this, 'serializeString'], $info['strings']);
		if (!empty($info['chars']))
		{
			// Prepend the character class to the list of alternations
			array_unshift($alternations, $this->serializeCharacterClass($info['chars']));
		}

		$expr = implode('|', $alternations);
		if ($this->needsParentheses($info))
		{
			$expr = '(?:' . $expr . ')';
		}

		return $expr . $info['quantifier'];
	}
738631
public function setCharset($charset)
    {
        if (is_string($charset)) {
            if (in_array($charset, mb_list_encodings())) {
                $this->charset = $charset;
            } else {
                throw new \InvalidArgumentException(
                    "Invalid value '" . $charset . "' for argument 'charset' given. Charset not supported."
                );
            }
        } else {
            throw new \InvalidArgumentException(
                "Invalid type '" . gettype($charset). "' for argument 'charset' given."
            );
        }

        return $this;
    }
1372997
public static final String generateHex(final Random random, final int characters)
	{
		if (characters < 1)
			throw new IllegalArgumentException("characters must be >= 1");

		final char[] str = new char[characters];

		for (int i = 0; i < characters; i++)
		{
			str[i] = hex[random.nextInt(16)];
		}

		return new String(str);
	}
872955
public function addStrings($strings)
    {
        foreach ($strings as $key => $string) {
            $this->addString($key, $string);
        }

        return $this;
    }
1294713
public function setAttributes($values){

        if(is_array($values)){
            foreach($values as $name => $value){
                $this->setAttribute($name, $value);
            }
        }else{
            throw new InvalidArgumentException('"values" must be an array');
        }

    }