Example #1
0
 /**
  * @param null $content
  * @param bool $force
  * @return $this|string
  */
 public function body($content = NULL, $force = false)
 {
     if (!$force && $content === NULL) {
         return $this->m_body;
     }
     // special error conditions
     if ($content instanceof \Generator) {
         throw new \LogicException('Generator cannot be converted to response');
     }
     if ($encoder = Application::content_type_encoder($this->content_type())) {
         $content = $encoder($content);
     }
     $this->m_body = (string) $content;
     return $this;
 }