Exemple #1
0
 public function setSubject($subject)
 {
     $subject = (string) $subject;
     if (!HeaderWrap::canBeEncoded($subject)) {
         throw new Exception\InvalidArgumentException('Subject value must be composed of printable US-ASCII or UTF-8 characters.');
     }
     $this->subject = $subject;
     $this->encoding = null;
     return $this;
 }
 /**
  * Set header value
  *
  * @param  string $fieldValue
  * @return GenericHeader
  * @throws Exception\InvalidArgumentException;
  */
 public function setFieldValue($fieldValue)
 {
     $fieldValue = (string) $fieldValue;
     if (!HeaderWrap::canBeEncoded($fieldValue)) {
         throw new Exception\InvalidArgumentException('Header value must be composed of printable US-ASCII characters and valid folding sequences.');
     }
     $this->fieldValue = $fieldValue;
     $this->encoding = null;
     return $this;
 }
 /**
  * Add a parameter pair
  *
  * @param  string $name
  * @param  string $value
  * @return ContentType
  * @throws Exception\InvalidArgumentException for parameter names that do not follow RFC 2822
  * @throws Exception\InvalidArgumentException for parameter values that do not follow RFC 2822
  */
 public function addParameter($name, $value)
 {
     $name = strtolower($name);
     $value = (string) $value;
     if (!HeaderValue::isValid($name)) {
         throw new Exception\InvalidArgumentException('Invalid content-type parameter name detected');
     }
     if (!HeaderWrap::canBeEncoded($value)) {
         throw new Exception\InvalidArgumentException('Parameter value must be composed of printable US-ASCII or UTF-8 characters.');
     }
     $this->parameters[$name] = $value;
     return $this;
 }