data = $data; } /** * @return bool|string */ public function toString() { $string = ''; foreach ($this->data as $key => $value) { $encode = rawurlencode($value); if ($encode === '') { $string .= "$key&"; } else { $string .= "$key=$encode&"; } } if (0 < count($this->data)) { $string = substr($string, 0, -1); } return $string; } /** * @return $this */ public function ksort() { ksort($this->data); return $this; } }