示例#1
0
 /**
  * Returns a string representation of the current request.
  *
  * @return string
  */
 public function __toString()
 {
     $string = sprintf("%s %s HTTP/%.1f\r\n", $this->getMethod(), $this->getResource(), $this->getProtocolVersion());
     if ($host = $this->getHost()) {
         $string .= 'Host: ' . $host . "\r\n";
     }
     if ($parent = trim(parent::__toString())) {
         $string .= $parent . "\r\n";
     }
     return $string;
 }
 private function detectContentType()
 {
     if (!class_exists('finfo', false)) {
         return false;
     }
     $finfo = new \finfo(FILEINFO_MIME_TYPE);
     return $this->file ? $finfo->file($this->file) : $finfo->buffer(parent::getContent());
 }