public function findMemberships($membership) { try { $soap = $this->readMembershipIdsForCollection(array('groupSourcedId' => $membership->getClassId(), 'collection' => 'courseSection')); $response = new Response($this); if ($response->getStatus() == 'error') { throw new TurnitinSDKException($response->getStatusCode(), $response->getDescription()); } else { $tiiMembership = new TiiMembership(); $membershipids = array(); if (isset($soap->sourcedIdSet->sourcedId)) { if (!is_array($soap->sourcedIdSet->sourcedId)) { $soap->sourcedIdSet->sourcedId = array($soap->sourcedIdSet->sourcedId); } foreach ($soap->sourcedIdSet->sourcedId as $id) { $membershipids[] = $id; } } $tiiMembership->setMembershipIds($membershipids); $response->setMembership($tiiMembership); } return $response; } catch (SoapFault $e) { throw new TurnitinSDKException($e->faultcode, $e->faultstring, parent::getLogPath()); } }