27 foreach ((array)
$values as $value) {
28 foreach ((array) $value as $v) {
36 return implode($this->glue .
' ', $this->
toArray());
39 public function add($value)
41 $this->values[] = $value;
53 $this->header = $name;
82 for ($i = 0, $total =
count(
$values); $i < $total; $i++) {
83 if (strpos(
$values[$i], $this->glue) !==
false) {
85 foreach (preg_split(
'/' . preg_quote($this->glue) .
'(?=([^"]*"[^"]*")*[^"]*$)/',
$values[$i]) as $v) {
92 $this->values = array_values(
$values);
99 return in_array($searchValue, $this->
toArray());
104 $this->values = array_values(array_filter($this->values,
function ($value) use ($searchValue) {
105 return $value != $searchValue;
123 return new \ArrayIterator($this->
toArray());
128 $params = $matches = array();
129 $callback = array($this,
'trimHeader');
134 foreach (preg_split(
'/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) as $kvp) {
135 if (!preg_match_all(
'/<[^>]+>|[^=]+/', $kvp, $matches)) {
138 $pieces = array_map($callback, $matches[0]);
139 $part[$pieces[0]] = isset($pieces[1]) ? $pieces[1] :
'';
156 return $this->header ==
$header;
178 static $trimmed =
"\"' \n\t";
180 return trim($str, $trimmed);