public function __construct($id, PaperOption $o = null, $values = [], $data_array = []) { $this->id = $id; $this->option = $o; $this->values = $values; $this->data_array = $data_array; if ($o && $o->takes_multiple()) { if ($o->type === "attachments") { array_multisort($this->data_array, SORT_NUMERIC, $this->values); } } else { $this->value = get($this->values, 0); if (!empty($this->data_array)) { $this->data = $this->data_array[0]; } } }