예제 #1
0
 private function getActivityModel()
 {
     $definition = null;
     $type = null;
     $moreInfo = null;
     if ($this->hasActivityDefinition) {
         $name = null;
         $description = null;
         $extensions = null;
         if ($this->hasActivityName) {
             $name = LanguageMap::create($this->activityName);
         }
         if ($this->hasActivityDescription) {
             $description = LanguageMap::create($this->activityDescription);
         }
         if (null !== $this->activityType) {
             $type = IRI::fromString($this->activityType);
         }
         if (null !== $this->activityMoreInfo) {
             $moreInfo = IRL::fromString($this->activityMoreInfo);
         }
         if (null !== $this->activityExtensions) {
             $extensions = $this->activityExtensions->getModel();
         }
         $definition = new Definition($name, $description, $type, $moreInfo, $extensions);
     }
     return new Activity(IRI::fromString($this->activityId), $definition);
 }
예제 #2
0
 public function getModel()
 {
     $score = null;
     $extensions = null;
     if ($this->hasScore) {
         $score = new Score($this->scaled, $this->raw, $this->min, $this->max);
     }
     if (null !== $this->extensions) {
         $extensions = $this->extensions->getModel();
     }
     return new ResultModel($score, $this->success, $this->completion, $this->response, $this->duration, $extensions);
 }
예제 #3
0
 public function getModel()
 {
     $context = new ContextModel();
     $context = $context->withRegistration($this->registration);
     $context = $context->withRevision($this->revision);
     $context = $context->withPlatform($this->platform);
     $context = $context->withLanguage($this->language);
     if (null !== $this->instructor) {
         $context = $context->withInstructor($this->instructor->getModel());
     }
     if (null !== $this->team) {
         $context = $context->withTeam($this->team->getModel());
     }
     if ($this->hasContextActivities) {
         $contextActivities = new ContextActivities();
         if (null !== $this->parentActivities) {
             foreach ($this->parentActivities as $contextParentActivity) {
                 $contextActivities = $contextActivities->withAddedParentActivity($contextParentActivity->getModel());
             }
         }
         if (null !== $this->groupingActivities) {
             foreach ($this->groupingActivities as $contextGroupingActivity) {
                 $contextActivities = $contextActivities->withAddedGroupingActivity($contextGroupingActivity->getModel());
             }
         }
         if (null !== $this->categoryActivities) {
             foreach ($this->categoryActivities as $contextCategoryActivity) {
                 $contextActivities = $contextActivities->withAddedCategoryActivity($contextCategoryActivity->getModel());
             }
         }
         if (null !== $this->otherActivities) {
             foreach ($this->otherActivities as $contextOtherActivity) {
                 $contextActivities = $contextActivities->withAddedOtherActivity($contextOtherActivity->getModel());
             }
         }
         $context = $context->withContextActivities($contextActivities);
     }
     if (null !== $this->statement) {
         $context = $context->withStatement(new StatementReference(StatementId::fromString($this->statement)));
     }
     if (null !== $this->extensions) {
         $context = $context->withExtensions($this->extensions->getModel());
     }
     return $context;
 }