public function convertFromJson($object, $json) { $value = Utils::getArrayValue($json, $this->jsonFieldName); $result = Conversions::createFromJSON($this->className, $value, false); $fieldName = $this->objectFieldName; $object->{$fieldName} = $result; }
protected function getOrCreateClientCorrelator($clientCorrelator = null) { if ($clientCorrelator) { return $clientCorrelator; } return Utils::randomAlphanumericString(); }
function __convert_sms_exception_from_json($object, $json) { $exception = Utils::getArrayValue($json, 'requestError.serviceException', Utils::getArrayValue($json, 'requestError.policyException', null)); if ($exception) { $object->messageId = Utils::getArrayValue($exception, 'messageId', ''); $object->text = Utils::getArrayValue($exception, 'text', ''); $object->variables = Utils::getArrayValue($exception, 'variables', array()); } }
public static function unserializeInboundMessages($json = null) { if ($json === null) { $json = file_get_contents("php://input"); } $json = json_decode($json, true); $json = Utils::getArrayValue($json, 'inboundSMSMessage.0'); return Conversions::createFromJSON('infobip\\models\\InboundSmsMessage', $json); }
function __convert_inbound_sms_messages($object, $jsonData) { $messages = Utils::getArrayValue($jsonData, 'inboundSMSMessageList.inboundSMSMessage', array()); $object->inboundSMSMessage = array(); foreach ($messages as $message) { $object->inboundSMSMessage[] = Conversions::createFromJSON('infobip\\models\\InboundSmsMessage', $message, false); } $object->numberOfMessagesInThisBatch = Utils::getArrayValue($jsonData, 'inboundSMSMessageList.numberOfMessagesInThisBatch', 0); $object->totalNumberOfPendingMessages = Utils::getArrayValue($jsonData, 'inboundSMSMessageList.totalNumberOfPendingMessages', 0); $object->callbackData = Utils::getArrayValue($jsonData, 'inboundSMSMessageList.callbackData'); }
public function convertFromJson($object, $json) { $value = Utils::getArrayValue($json, $this->jsonFieldName); // Value is an url, the last part is the subscription id: $parts = explode('/', $value); if ($value && sizeof($parts) > 0) { $value = $parts[sizeof($parts) - 2]; } $fieldName = $this->objectFieldName; $object->{$fieldName} = $value; }
function __convert_ib_auth_from_json($object, $json) { $data = Utils::getArrayValue($json, 'login', Utils::getArrayValue($json, 'signup', '')); if (Utils::getArrayValue($data, 'ibAuthCookie', '') !== '') { $object->username = ''; $object->password = ''; $object->ibssoToken = Utils::getArrayValue($data, 'ibAuthCookie', ''); $object->authenticated = $object->ibssoToken !== ''; $object->verified = Utils::getArrayValue($data, 'verified', 'false') === 'true'; } else { $object->authenticated = false; $object->verified = false; } }
public function convertFromJson($object, $json) { $values = Utils::getArrayValue($json, $this->jsonFieldName); if (!is_array($values)) { Logs::warn('Looking for array (', $this->jsonFieldName, '), but found:', $values); return null; } $result = array(); foreach ($values as $value) { $result[] = Conversions::createFromJSON($this->className, $value, false); } $fieldName = $this->objectFieldName; $object->{$fieldName} = $result; }
public function convertFromJson($object, $json) { $value = Utils::getArrayValue($json, $this->jsonFieldName); $fieldName = $this->objectFieldName; $object->{$fieldName} = $value; }
public function checkUsername($uname) { $restPath = '/1/customerProfile/username/check'; list($isSuccess, $content) = $this->executeGET($this->getRestUrl($restPath), array('username' => $uname)); return Utils::getArrayValue($content, 'usernameCheck', false) == true; }