public function debug($withResponse = TRUE, $withResponseBody = TRUE) { $text = "== Request Headers ===============================\n"; if ($this->isGet() && count((array) $this->data) > 0) { $text .= 'URL: ' . $this->url . "?" . http_build_query((array) $this->data) . "\n"; } else { $text .= 'URL: ' . $this->url . "\n"; } if (isset($this->response)) { // aka request wurde schon abgeschickt, dann zeige hier die gesendeten headers an $text .= $this->getHeaders() . "\n"; } else { foreach ($this->httpHeaders as $name => $value) { $text .= $name . ': ' . $value . "\n"; } } $text .= "== Body (Type: " . $this->type . ") =================\n"; if (array_key_exists('Content-Type', $this->httpHeaders) && mb_strpos($this->httpHeaders['Content-Type'], 'multipart/form-data') !== FALSE) { $text .= '<cannot display multipart body on debug>' . "\n"; } else { $text .= \Psc\Doctrine\Helper::getDump($this->data, 8); } $text .= "=================================================\n"; if ($withResponse) { $text .= "\n"; $text .= "== Response =====================================\n"; if (isset($this->response)) { $text .= $this->getResponseHeader()->debug() . "\n"; if ($withResponseBody) { $text .= "== Body =========================================\n"; $text .= $this->response->getRaw() . "\n"; } } else { $text .= '[noch keine Response]' . "\n"; } $text .= "=================================================\n"; } return $text; }
public function __toString() { try { $str = 'Event[' . $this->getIdentifier() . '] ' . "\n"; $str .= 'Target: ' . Code::varInfo($this->target) . "\n"; $str .= 'Daten: ' . \Psc\Doctrine\Helper::getDump($this->data, $maxDepth = 1) . "\n"; } catch (\Exception $e) { print $e; exit; } return $str; }
public function debug() { $text = "== Psc\\Net\\HTTP\\Response =========================\n"; //$text .= $this->getCode().' : '.$this->getReason()."\n"; $text .= $this->getHeader() . "\n"; $text .= "== Response-Body =================================\n"; $text .= \Psc\Doctrine\Helper::getDump((array) $this->body, 4); $text .= "=================================================\n"; /* $text .= "\n"; $text .= "== Response =====================================\n"; $text .= $this->getResponseHeader()."\n"; $text .= "== Body =========================================\n"; $text .= $this->response->getRaw()."\n"; $text .= "=================================================\n"; */ return $text; }