public function slice($names, array $attr = null)
{
$names = (array) $names;
$ret = array();
foreach ($names as $name) {
$offset = 0;
$slices = array();
while ($slice = $this->find_slice($offset, $name, $attr)) {
$slices[] = $slice;
$offset = $slice->get_end_offset();
}
// Need to reverse this because we need to splice the last chunks first
// if we splice the earlier chunks first, then the offsets get all
// messed up. Trust me.
$ret = array_merge($ret, array_reverse($slices));
}
return $ret;
}