本文整理汇总了PHP中Response::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::__construct方法的具体用法?PHP Response::__construct怎么用?PHP Response::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Response
的用法示例。
在下文中一共展示了Response::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param string $response
*/
public function __construct($response)
{
parent::__construct($response);
$this->name = $this->getResponseValue('name');
$this->newMessages = $this->getResponseValue('new_messages');
$this->oldMessages = $this->getResponseValue('old_messages');
}
示例2: __construct
/**
* @inheritdoc
*/
public function __construct(\SimpleXMLElement $response)
{
parent::__construct($response);
if (!empty($response->EndTime)) {
$this->end_time = (string) $response->EndTime;
}
}
示例3: __construct
/**
* Initializes the `Location` header.
*
* @param string $url URL to redirect to.
* @param int $status Status code (default to {@link Status::FOUND}).
* @param array $headers Additional headers.
*
* @throws \InvalidArgumentException if the provided status code is not a redirect.
*/
public function __construct($url, $status = Status::FOUND, array $headers = [])
{
parent::__construct(function (Response $response) {
$location = $response->location;
$title = \ICanBoogie\escape($location);
echo <<<EOT
<!DOCTYPE html>
<html>
<head>
\t<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\t<meta http-equiv="refresh" content="1;url={$location}" />
\t<title>Redirecting to {$title}</title>
</head>
<body>
\tRedirecting to <a href="{$location}">{$title}</a>.
</body>
</html>
EOT;
// @codeCoverageIgnore
}, $status, ['Location' => $url] + $headers);
if (!$this->status->is_redirect) {
throw new StatusCodeNotValid($this->status->code, "The HTTP status code is not a redirect: {$status}.");
}
}
示例4: __construct
/**
* @param string $response
*/
public function __construct($response)
{
parent::__construct($response);
$this->context = $this->getResponseValue('context');
$this->exten = $this->getResponseValue('exten');
$this->priority = $this->getResponseValue('priority');
}
示例5: __construct
/**
* @param string $appName: the name of your app
*/
public function __construct($appName)
{
parent::__construct();
$this->appName = $appName;
$this->data = array();
$this->error = false;
}
示例6: __construct
/**
* Constructor.
*
* @param mixed $data The response data
* @param int $status The response status code
* @param array $headers An array of response headers
*/
public function __construct(array $data, $status = 200, $headers = array())
{
parent::__construct('', $status, $headers);
$data = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT);
$this->header->set('Content-Type', 'application/json; charset=utf-8;');
$this->setContent($data);
}
示例7: __construct
/**
* Construct the Info object by parsing the XML.
* @param xml_doc the DOM XML document
* @exception if the response is not valid
*/
public function __construct(\DOMDocument $xml_doc)
{
parent::__construct($xml_doc);
$xpath = new \DOMXPath($xml_doc);
$this->campaign_id = $xpath->evaluate('/response/campaign_id')->item(0)->nodeValue;
$this->from_number = $xpath->evaluate('/response/from')->item(0)->nodeValue;
$this->from_name = $xpath->evaluate('/response/from_name')->item(0)->nodeValue;
$this->to_number = $xpath->evaluate('/response/to')->item(0)->nodeValue;
$this->to_name = $xpath->evaluate('/response/to_name')->item(0)->nodeValue;
$this->content_id = $xpath->evaluate('/response/content_id')->item(0)->nodeValue;
$this->status = $xpath->evaluate('/response/status')->item(0)->nodeValue;
$events = $xpath->query('/response/history/event');
$this->history = array();
foreach ($events as $event) {
$timestamp = $event->getAttribute('timestamp');
if (array_key_exists($timestamp, $this->history)) {
array_push($this->history[$timestamp], $event->nodeValue);
} else {
$this->history[$timestamp] = array($event->nodeValue);
}
}
if (!isset($this->campaign_id, $this->from_number, $this->from_name, $this->to_number, $this->to_name, $this->content_id, $this->content_id, $this->status, $this->status, $this->history)) {
throw new \Exception("Invalid Lookup response.");
}
}
示例8: __construct
/**
* @param string $response
*/
public function __construct($response)
{
parent::__construct($response);
$this->name = $this->response->name;
$this->newMessages = $this->response->new_messages;
$this->oldMessages = $this->response->old_messages;
}
示例9: __construct
/**
* @param string $response
*/
public function __construct($response)
{
parent::__construct($response);
$this->context = $this->response->context;
$this->exten = $this->response->exten;
$this->priority = $this->response->priority;
}
示例10: __construct
/**
* Constructor
*
* @param string $type
* @param integer $tid
* @param string $action
* @param string $method
*/
public function __construct($type, $tid, $action, $method)
{
parent::__construct($type);
$this->tid = $tid;
$this->action = $action;
$this->method = $method;
}
示例11: __construct
/**
* @inheritdoc
*/
public function __construct(\SimpleXMLElement $response)
{
parent::__construct($response);
if (!empty($response->SiteHostedPictureDetails->FullURL)) {
$this->url = (string) $response->SiteHostedPictureDetails->FullURL;
}
}
示例12: __construct
/**
* Constructor of StreamedResponse class.
*
* @param \Cygnite\Http\Responses\callable $callback
* @param type $status
* @param type $headers
*/
public function __construct(callable $callback = null, $status = ResponseHeaders::HTTP_OK, $headers = [])
{
parent::__construct('', $status, $headers);
if ($callback !== null) {
$this->setCallback($callback);
}
}
示例13: __construct
/**
* @inheritdoc
*/
public function __construct(\SimpleXMLElement $response)
{
parent::__construct($response);
if (!empty($response->ItemID)) {
$this->external_id = (string) $response->ItemID;
}
}
示例14: __construct
/**
* @param $route
* @param int $status
* @param array $headers
*/
public function __construct($url, $status = 302, $headers = null)
{
parent::__construct(null, $status, $headers);
$this->target = $url;
$this->updateBody();
$this->updateHeaders();
}
示例15: __construct
/**
* Constructs the object
* @param \System\System\Interaction\Message The original message
* @param \System\IO\File A file object, or the data to send
*/
public function __construct(\System\System\Interaction\Message $originalMessage, $value)
{
if ($value instanceof \System\IO\File) {
$value = @base64_encode($value->getContents());
}
parent::__construct($originalMessage, $value);
}