95 $this->data = &$bodystructure;
97 if (is_array($bodystructure[0]))
101 $this->partsCount = count($bodystructure[0]);
104 $bodystructure[0][$i] =
new static(
105 $bodystructure[0][$i],
106 (string) (!is_null(
$number) ? sprintf(
'%s.%u',
$number, $i + 1) : $i + 1)
123 if (!empty($bodystructure[2]) && is_array($bodystructure[2]))
127 $count = count($bodystructure[2]);
128 for ($i = 0; $i < $count; $i += 2)
130 $params[mb_strtolower($bodystructure[2][$i])] = $bodystructure[2][$i + 1];
133 $bodystructure[2] = $params;
138 $disposition[0] = mb_strtolower($disposition[0]);
139 if (!empty($disposition[1]) && is_array($disposition[1]))
143 $count = count($disposition[1]);
144 for ($i = 0; $i < $count; $i += 2)
146 $params[mb_strtolower($disposition[1][$i])] = $disposition[1][$i + 1];
149 $disposition[1] = $params;
234 public function traverse(callable $callback, $flat =
false)
242 $items[] = $this->data[0][$i]->traverse($callback, $flat);
246 $result = array($callback($this, $items));
250 $result = array_merge($result, ...$items);