本文整理汇总了PHP中AbstractResponse类的典型用法代码示例。如果您正苦于以下问题:PHP AbstractResponse类的具体用法?PHP AbstractResponse怎么用?PHP AbstractResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AbstractResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHttpResponse
/**
* (non-PHPdoc)
* @see \InoOicServer\OpenIdConnect\Response\AbstractResponse::getHttpResponse()
* @return \Zend\Http\Response
*/
public function getHttpResponse()
{
$httpResponse = parent::getHttpResponse();
$httpResponse->getHeaders()->addHeaders(array('Content-Type' => 'application/json'));
if ($this->isError()) {
$httpResponse->setStatusCode($this->_errorHttpStatusCode);
$httpResponse->setContent($this->_createErrorResponseContent());
} else {
$httpResponse->setContent($this->_createResponseContent());
}
return $httpResponse;
}
示例2: __construct
/**
* Constructor
*
* @access public
* @param unknown_type $url
* @param array $headers
* @param unknown_type $response
* @param unknown_type $responseCode
* @param unknown_type $responseMessage
* @constructor
* @return void
*/
public function __construct($url, array $headers, $response, $responseCode, $responseMessage)
{
parent::__construct($url, $headers, $response);
$this->responseCode = $responseCode;
$this->responseMessage = $responseMessage;
$this->_parseHeaders($headers);
}
示例3: __construct
public function __construct($data)
{
parent::__construct($data);
foreach ($this->data['trackings'] as $courier) {
$this->trackings[] = new TrackingInfoShortResponse(array('result' => $courier));
}
}
示例4: __construct
public function __construct($data)
{
parent::__construct($data);
foreach ($this->data as $courier) {
$this->couriers[] = new CourierResponse(array('result' => $courier));
}
}
示例5:
/**
* @param $data
*/
function __construct($data)
{
if (is_object($data)) {
$this->obj = $data;
} else {
if (is_string($data)) {
parent::__construct($data);
}
}
if (isset($this->obj->username)) {
$this->username = $this->obj->username;
}
if (isset($this->obj->limit)) {
$this->limit = $this->obj->limit;
}
if (isset($this->obj->month_limit)) {
$this->monthLimit = $this->obj->month_limit;
}
if (isset($this->obj->senders)) {
$this->senders = $this->obj->senders;
}
if (isset($this->obj->phonebook)) {
$this->phonebook = $this->obj->phonebook;
}
if (isset($this->obj->active)) {
$this->active = $this->obj->active;
}
if (isset($this->obj->info)) {
$this->info = $this->obj->info;
}
}
示例6: __construct
public function __construct($data)
{
parent::__construct($data);
if ($this->data['last_checkpoint']) {
$this->lastCheckpoint = new CheckpointResponse(array('result' => $this->data['last_checkpoint']));
}
}
示例7: parseResponse
public function parseResponse()
{
parent::parseResponse();
if (!$this->wasSuccessful()) {
return;
}
$hits = $this->parsedData->hits->hit;
if (0 === count($hits)) {
$this->hits = null;
return;
}
$returnHits = array();
foreach ($hits as $hit) {
if (isset($hit->data)) {
$returnHits[$hit->id] = $hit->data;
} else {
$returnHits[$hit->id] = $hit->id;
}
}
foreach ($returnHits as $key => $hit) {
if (is_object($hit)) {
foreach ($hit as $dataKey => $data) {
$returnHits[$key]->{$dataKey} = !empty($data) ? $data[0] : null;
}
}
}
$this->hits = $returnHits;
}
示例8: getETag
public function getETag()
{
$eTag = parent::getETag();
if ($eTag === null) {
$eTag = md5($this->string);
}
return $eTag;
}
示例9: __construct
/**
* {@inheritdoc}
*/
public function __construct($parameters)
{
parent::__construct($parameters);
$this->status = $this->filteredParameters['STATUS'];
if (array_key_exists('REMISE', $this->filteredParameters)) {
$this->discount = $this->filteredParameters['REMISE'];
}
}
示例10: foreach
/**
* @param $data
*/
function __construct($data)
{
parent::__construct($data);
$this->list = new \ArrayObject();
if (isset($this->obj)) {
foreach ($this->obj as $res) {
$this->list->append(new SenderResponse($res));
}
}
}
示例11: __construct
public function __construct($data)
{
parent::__construct($data);
if (isset($this->obj->proCount)) {
$this->proCount = $this->obj->proCount;
}
if (isset($this->obj->ecoCount)) {
$this->ecoCount = $this->obj->ecoCount;
}
}
示例12: __construct
public function __construct($data)
{
parent::__construct($data);
foreach ($this->data['checkpoints'] as $checkpoint) {
$this->checkpoints[] = new CheckpointResponse(array('result' => $checkpoint));
}
foreach ($this->data['extra'] as $extra) {
$this->extra[] = new TrackingExtraResponse(array('result' => $extra));
}
}
示例13: chunk
/**
* Enable response chunking
*
* @link https://github.com/chriso/klein.php/wiki/Response-Chunking
* @link http://bit.ly/hg3gHb
* @param string $str An optional string to send as a response "chunk"
* @access public
* @return Response
*/
public function chunk($str = null)
{
parent::chunk();
if (null !== $str) {
printf("%x\r\n", strlen($str));
echo "{$str}\r\n";
flush();
}
return $this;
}
示例14:
/**
* @param $data
*/
function __construct($data)
{
parent::__construct($data);
if (isset($this->obj->error)) {
$this->code = $this->obj->error;
}
if (isset($this->obj->message)) {
$this->message = $this->obj->message;
}
}
示例15: deliverPayLoad
/**
* @return $this
* @throws \Exception
*/
public function deliverPayLoad()
{
$this->addHeader('Content-Type: application/json');
if ($this->json) {
$this->addBodyFragment($this->json);
} else {
throw new \Exception("No JSON", 500);
}
return parent::deliverPayLoad();
}