Ejemplo n.º 1
0
 /**
  * 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);
 }
Ejemplo n.º 2
0
 public function __construct($data)
 {
     parent::__construct($data);
     foreach ($this->data['trackings'] as $courier) {
         $this->trackings[] = new TrackingInfoShortResponse(array('result' => $courier));
     }
 }
Ejemplo n.º 3
0
 public function __construct($data)
 {
     parent::__construct($data);
     foreach ($this->data as $courier) {
         $this->couriers[] = new CourierResponse(array('result' => $courier));
     }
 }
Ejemplo n.º 4
0
 /**
  * @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;
     }
 }
 public function __construct($data)
 {
     parent::__construct($data);
     if ($this->data['last_checkpoint']) {
         $this->lastCheckpoint = new CheckpointResponse(array('result' => $this->data['last_checkpoint']));
     }
 }
 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;
 }
Ejemplo n.º 7
0
 public function getETag()
 {
     $eTag = parent::getETag();
     if ($eTag === null) {
         $eTag = md5($this->string);
     }
     return $eTag;
 }
Ejemplo n.º 8
0
 /**
  * {@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'];
     }
 }
 /**
  * @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));
         }
     }
 }
 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;
     }
 }
Ejemplo n.º 11
0
 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));
     }
 }
Ejemplo n.º 12
0
 /**
  * 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;
 }
Ejemplo n.º 13
0
 /**
  * @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;
     }
 }
Ejemplo n.º 14
0
 /**
  * @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();
 }
 public function __construct($step_number, $step_title, Template $view)
 {
     $this->load_language_resources();
     $this->init_response($step_number, $view);
     $env = new InstallDisplayGraphicalEnvironment();
     $this->add_language_bar();
     $this->init_steps();
     $this->update_progress_bar();
     $this->full_view->put_all(array('RESTART' => InstallUrlBuilder::welcome()->rel(), 'STEP_TITLE' => $step_title, 'C_HAS_PREVIOUS_STEP' => false, 'C_HAS_NEXT_STEP' => false, 'L_XML_LANGUAGE' => LangLoader::get_message('xml_lang', 'main'), 'PROGRESSION' => floor(100 * $this->current_step / ($this->nb_steps - 1)), 'PHPBOOST_VERSION' => GeneralConfig::load()->get_phpboost_major_version()));
     parent::__construct($env, $this->full_view);
 }
 public function __construct($step_number, $step_title, Template $view)
 {
     $this->load_language_resources();
     $this->init_response($step_number, $view);
     $env = new UpdateDisplayGraphicalEnvironment();
     $this->add_language_bar();
     $this->init_steps();
     $this->update_progress_bar();
     $this->full_view->put_all(array('RESTART' => UpdateUrlBuilder::introduction()->rel(), 'STEP_TITLE' => $step_title, 'C_HAS_PREVIOUS_STEP' => false, 'C_HAS_NEXT_STEP' => false, 'L_XML_LANGUAGE' => LangLoader::get_message('xml_lang', 'main'), 'PROGRESSION' => floor(100 * $this->current_step / $this->nb_steps)));
     parent::__construct($env, $this->full_view);
 }
Ejemplo n.º 17
0
 public function getETag()
 {
     $eTag = parent::getETag();
     if ($eTag === null) {
         if ($this->md5) {
             $eTag = md5_file($this->path);
         } else {
             $eTag = sprintf('%x-%x', filesize($this->path), filemtime($this->path));
         }
     }
     return $eTag;
 }
 /**
  * (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;
 }
Ejemplo n.º 19
0
 /**
  * @param string $json
  */
 public function __construct($json)
 {
     $pagination = json_decode($json, true);
     if (!empty($pagination['links'])) {
         $headerLinks = [];
         foreach ($this->links as $linkName => $relName) {
             if (!empty($pagination['links'][$linkName]['href'])) {
                 $headerLinks[] = sprintf('<%s>; rel="%s"', $pagination['links'][$linkName]['href'], $relName);
             }
         }
         if (!empty($headerLinks)) {
             $this->headers['Link'] = implode(', ', $headerLinks);
         }
     }
     parent::__construct($json);
 }
Ejemplo n.º 20
0
 /**
  *
  * @param array $response
  * @return void
  */
 public function __construct($response = array())
 {
     if (isset($response['data'])) {
         parent::__construct($response);
         $data = $response['data'];
     } else {
         $data = $response;
     }
     $this->_uuid = isset($data['uuid']) ? $data['uuid'] : null;
     $this->_isValid = isset($data['isValid']) ? $data['isValid'] : false;
     $this->_usedAt = isset($data['usedAt']) ? $data['usedAt'] : null;
     $this->_activatedAt = isset($data['activatedAt']) ? $data['activatedAt'] : null;
     $this->_expiresAt = isset($data['expiresAt']) ? $data['expiresAt'] : null;
     if (isset($data['coupon'])) {
         $couponData = $data['coupon'];
         $couponData['uuid'] = $this->_uuid;
         $this->_coupon = new Coupon(array('data' => $couponData));
     }
 }
Ejemplo n.º 21
0
 /**
  * @param $data
  */
 function __construct($data)
 {
     if (is_object($data)) {
         $this->obj = $data;
     } else {
         if (is_string($data)) {
             parent::__construct($data);
         }
     }
     if (isset($this->obj->sender)) {
         $this->name = $this->obj->sender;
     }
     if (isset($this->obj->status)) {
         $this->status = $this->obj->status;
     }
     if (isset($this->obj->default)) {
         $this->default = $this->obj->default;
     }
 }
Ejemplo n.º 22
0
 /**
  * @param $data
  */
 function __construct($data)
 {
     if (is_object($data)) {
         $this->obj = $data;
     } else {
         if (is_string($data)) {
             parent::__construct($data);
         }
     }
     if (isset($this->obj->name)) {
         $this->name = $this->obj->name;
     }
     if (isset($this->obj->info)) {
         $this->info = $this->obj->info;
     }
     if (isset($this->obj->numbers_count)) {
         $this->numbers_count = $this->obj->numbers_count;
     }
 }
Ejemplo n.º 23
0
 public function parseResponse()
 {
     parent::parseResponse();
     if (!$this->wasSuccessful()) {
         return;
     }
     $hits = $this->parsedData->hits->hit;
     $this->props = $this->parsedData->hits;
     if (isset($this->parsedData->hits->cursor)) {
         $this->cursor = $this->parsedData->hits->cursor;
     }
     if (isset($this->parsedData->facets)) {
         $this->facets = $this->parsedData->facets;
     }
     if (0 === count($hits)) {
         $this->hits = null;
         return;
     }
     /* Not sure what this is supposed to do
     		 *
             $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;
     		*/
     $this->hits = $hits;
 }
Ejemplo n.º 24
0
 /**
  * Parse the response from AWS
  */
 public function parseResponse()
 {
     parent::parseResponse();
     if (!$this->wasSuccessful()) {
         return;
     }
     // Get actual suggestions as an array
     $suggestions = $this->parsedData->suggest->suggestions;
     if (0 === count($suggestions)) {
         // No suggestions...
         $this->suggestions = null;
         return;
     }
     /*
             $returnSuggestions = array();
             foreach ($suggestions as $suggestion) {
                 if (isset($suggestion->suggestion)) {
                     $returnSuggestions[$suggestion->id] = $suggestion->suggestion;
                 }
             }
     */
     $this->suggestions = $suggestions;
 }
 public function __construct($response)
 {
     parent::__construct($response);
 }
 /**
  * @param $data
  */
 function __construct($data)
 {
     parent::__construct($data);
     $this->count = isset($this->obj->count) ? $this->obj->count : 0;
 }
Ejemplo n.º 27
0
 public function flush()
 {
     if (sizeof($this->fieldValues) > 0) {
         $this->set('fieldValues', $this->fieldValues);
     }
     if (sizeof($this->fieldErrors) > 0) {
         $this->set('fieldErrors', $this->fieldErrors);
     }
     parent::flush();
 }
 public function __construct($view)
 {
     parent::__construct(new SiteNodisplayGraphicalEnvironment(), $view);
 }
Ejemplo n.º 29
0
 /**
  * @inheritdoc
  */
 function __construct($response = null, $data = null)
 {
     parent::__construct($response, $data);
 }
Ejemplo n.º 30
0
 /**
  * @param string    $response
  * @param mixed     $data
  * @param int       $id
  */
 function __construct($response, $data = null, $id = null)
 {
     parent::__construct($response, $data);
     $this->id = $id;
 }