当前位置: 首页>>代码示例>>PHP>>正文


PHP Response::__construct方法代码示例

本文整理汇总了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');
 }
开发者ID:wormling,项目名称:phparia,代码行数:10,代码来源:Mailbox.php

示例2: __construct

 /**
  * @inheritdoc
  */
 public function __construct(\SimpleXMLElement $response)
 {
     parent::__construct($response);
     if (!empty($response->EndTime)) {
         $this->end_time = (string) $response->EndTime;
     }
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:10,代码来源:EndItemResponse.php

示例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}.");
        }
    }
开发者ID:icanboogie,项目名称:http,代码行数:34,代码来源:RedirectResponse.php

示例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');
 }
开发者ID:wormling,项目名称:phparia,代码行数:10,代码来源:DialplanCep.php

示例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;
 }
开发者ID:nanowish,项目名称:apps,代码行数:10,代码来源:json.response.php

示例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);
 }
开发者ID:RunnerLee,项目名称:http,代码行数:14,代码来源:JsonResponse.php

示例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.");
     }
 }
开发者ID:SerdarSanri,项目名称:mogreet,代码行数:30,代码来源:Lookup.class.php

示例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;
 }
开发者ID:stgnet,项目名称:phparia,代码行数:10,代码来源:Mailbox.php

示例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;
 }
开发者ID:stgnet,项目名称:phparia,代码行数:10,代码来源:DialplanCep.php

示例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;
 }
开发者ID:teqneers,项目名称:ext-direct,代码行数:15,代码来源:AbstractTransactionResponse.php

示例11: __construct

 /**
  * @inheritdoc
  */
 public function __construct(\SimpleXMLElement $response)
 {
     parent::__construct($response);
     if (!empty($response->SiteHostedPictureDetails->FullURL)) {
         $this->url = (string) $response->SiteHostedPictureDetails->FullURL;
     }
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:10,代码来源:UploadSiteHostedPicturesResponse.php

示例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);
     }
 }
开发者ID:cygnite,项目名称:framework,代码行数:14,代码来源:StreamedResponse.php

示例13: __construct

 /**
  * @inheritdoc
  */
 public function __construct(\SimpleXMLElement $response)
 {
     parent::__construct($response);
     if (!empty($response->ItemID)) {
         $this->external_id = (string) $response->ItemID;
     }
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:10,代码来源:ReviseItemResponse.php

示例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();
 }
开发者ID:PrafullaKumarSahu,项目名称:wordpress-socializr,代码行数:12,代码来源:RedirectResponse.php

示例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);
 }
开发者ID:Superbeest,项目名称:Core,代码行数:12,代码来源:FileResponse.class.php


注:本文中的Response::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。