public function readUsers($user) { try { $soap = $this->readPersons(array('sourcedIdSet' => array('sourcedId' => $user->getUserIds()))); $response = new Response($this); if ($response->getStatus() == 'error') { throw new TurnitinSDKException($response->getStatusCode(), $response->getDescription()); } else { $users = array(); if (isset($soap->personRecordSet->personRecord)) { if (!is_array($soap->personRecordSet->personRecord)) { $soap->personRecordSet->personRecord = array($soap->personRecordSet->personRecord); } foreach ($soap->personRecordSet->personRecord as $record) { $tiiUser = new TiiUser(); $tiiUser->setUserId($record->sourcedGUID->sourcedId); $tiiUser->setDefaultRole($record->person->roles->institutionRole->institutionroletype->instanceValue->textString); $tiiUser->setEmail($record->person->contactinfo->contactinfoValue->textString); foreach ($record->person->name->partName as $partname) { if ($partname->instanceName->textString == 'First') { $tiiUser->setFirstname($partname->instanceValue->textString); } else { if ($partname->instanceName->textString == 'Last') { $tiiUser->setLastname($partname->instanceValue->textString); } } $record->person->extension->extensionField = is_array($record->person->extension->extensionField) ? $record->person->extension->extensionField : array($record->person->extension->extensionField); foreach ($record->person->extension->extensionField as $field) { $name = $field->fieldName; $method = 'set' . $name; if (is_callable(array($tiiUser, $method))) { $tiiUser->{$method}($field->fieldValue); } } } $users[] = $tiiUser; } } $response->setUsers($users); } return $response; } catch (SoapFault $e) { throw new TurnitinSDKException($e->faultcode, $e->faultstring, parent::getLogPath()); } }