/** * Initializes a new instance of that class. * * @param IEnumerable $grps The sequence of groupings. * * @throws \System\ArgumentException */ public function __construct($grps) { $grps = static::asIterator($grps, true); $dict = new Dictionary(null, null, null, \sprintf('$x => $x instanceof %s', IGrouping::class)); while ($grps->valid()) { /* @var IGrouping $curGrouping */ $curGrouping = $grps->current(); $dict->add($curGrouping->key(), $curGrouping); $grps->next(); } parent::__construct($dict); }
private function httpFiles() { $array = array(); foreach ($_FILES as $name => $file) { if (is_array($file['name'])) { $count = count($file['name']); for ($i = 0; $i < $count; $i++) { if ($file['error'][$i] == UPLOAD_ERR_OK) { $array[$name . $i]['name'] = $file['name'][$i]; $array[$name . $i]['type'] = $file['type'][$i]; $array[$name . $i]['tmp_name'] = $file['tmp_name'][$i]; $array[$name . $i]['size'] = $file['size'][$i]; } } } else { if ($file['error'] == UPLOAD_ERR_OK) { $array[$name] = $file; } } } $list = new Dictionary(); foreach ($array as $key => $item) { $list->add($key, new HttpFile($item['name'], $item['tmp_name'], $item['type'], $item['size'])); } return $list; }