public function prepareForTransport($secret, $payloadId, $requestId) { $data = json_encode(Objects::propertyValues($this)); $this->_dataHash = md5($data); $this->_signature = md5($secret . $this->_dataHash); $this->_payloadId = $payloadId; $this->_requestId = $requestId; }
public function hydrate($source) { if (is_object($source)) { $source = Objects::propertyValues($source); } foreach (Objects::properties($this) as $property) { if (isset($source[$property])) { $this->{$property} = $source[$property]; } } return $this; }
/** * Hydrate the public properties * * @param $data */ public function hydrate($data) { if ($data) { foreach (Objects::propertyValues($this) as $key => $value) { if (is_array($data)) { $this->{$key} = Arrays::value($data, $key, $value); } else { if (is_object($data)) { $this->{$key} = Objects::property($data, $key, $value); } } } } }
/** * Return an array with only the public properties and their values. * * If calling get_object_vars withing a class, * will return protected and private properties, * this function fixes this instance * * @param object $object Source object * @param bool $returnKeys Return Property keys * * @return mixed * * @deprecated */ function get_public_properties($object, $returnKeys = false) { return $returnKeys ? \Packaged\Helpers\Objects::properties($object) : \Packaged\Helpers\Objects::propertyValues($object); }
/** * (PHP 5 >= 5.4.0)<br/> * Specify data which should be serialized to JSON * * @link http://php.net/manual/en/jsonserializable.jsonserialize.php * @return mixed data which can be serialized by <b>json_encode</b>, * which is a value of any type other than a resource. */ public function jsonSerialize() { return Objects::propertyValues($this); }
/** * (PHP 5 >= 5.4.0)<br/> * Specify data which should be serialized to JSON * @link http://php.net/manual/en/jsonserializable.jsonserialize.php * @return mixed data which can be serialized by <b>json_encode</b>, * which is a value of any type other than a resource. */ public function jsonSerialize() { $this->_prepareDaos(); if ($this->isEmpty()) { return []; } $response = []; foreach ($this->_daos as $dao) { if ($dao instanceof \JsonSerializable) { $response[] = $dao->jsonSerialize(); } else { $response[] = Objects::propertyValues($dao); } } return $response; }
public function publicVars() { return Objects::propertyValues($this); }
/** * Retrieve the response data as an array * * @return array */ public function toArray() { return Objects::propertyValues($this); }
public function getData() { return Objects::propertyValues($this); }
/** * @param $jobId * * @return \Google_Service_Bigquery_Job * @throws \Exception */ public function waitForJob($jobId) { while (true) { $res = $this->getService()->jobs->get($this->bigQueryProject(), $jobId); /** @var \Google_Service_Bigquery_JobStatus $status */ $status = $res->getStatus(); if ($status->getState() != 'RUNNING') { /** @var \Google_Service_Bigquery_ErrorProto $err */ $err = $status->getErrorResult(); if ($err) { // TODO: Deal with missing tables...? throw new \Exception('Error running BigQuery job ' . $jobId . ' : ' . json_encode(Objects::propertyValues($err))); } return $res; } usleep(500000); } throw new \Exception('Error waiting for BigQuery job ' . $jobId); }