public function readClasses($class) { try { $soap = $this->readCourseSections(array('sourcedIdSet' => array('sourcedId' => $class->getClassIds()))); $response = new Response($this); if ($response->getStatus() == 'error') { throw new TurnitinSDKException($response->getStatusCode(), $response->getDescription(), parent::getLogPath()); } else { $classes = array(); if (isset($soap->courseSectionRecordSet->courseSectionRecord)) { if (!is_array($soap->courseSectionRecordSet->courseSectionRecord)) { $soap->courseSectionRecordSet->courseSectionRecord = array($soap->courseSectionRecordSet->courseSectionRecord); } foreach ($soap->courseSectionRecordSet->courseSectionRecord as $record) { $tiiClass = new TiiClass(); $tiiClass->setClassId($record->sourcedGUID->sourcedId); $tiiClass->setTitle($record->courseSection->title->textString); $tiiClass->setEndDate($record->courseSection->timeFrame->end); foreach ($record->courseSection->extension->extensionField as $field) { $name = $field->fieldName; $method = 'set' . $name; if (is_callable(array($tiiClass, $method))) { $tiiClass->{$method}($field->fieldValue); } } $classes[] = $tiiClass; } } $response->setClasses($classes); } return $response; } catch (SoapFault $e) { throw new TurnitinSDKException($e->faultcode, $e->faultstring, parent::getLogPath()); } }