/**
  * Creates a new LearningObject representing an existing object in the LMS
  * @param string $type
  * @param string $loId
  * @return intuitelLO new instance
  * @throws intuitel\UnknownLOException
  */
 public static function createLO(LOId $loId)
 {
     $idfactory = Intuitel::getIDFactory();
     $type = $idfactory->getType($loId);
     try {
         $factory = Intuitel::getLOFactory($type);
     } catch (UnknownLOTypeException $ex) {
         $factory = new GenericLOFactory();
     }
     return $factory->createLO($loId);
 }
 function getGuessedFactory($data)
 {
     $type = null;
     if (isset($data->category) && isset($data->shortname)) {
         // Moodle course
         $type = 'course';
     } else {
         if ($data instanceof \cm_info) {
             // || (($data->module)) // Moodle activity
             $type = $data->modname;
         } else {
             if (isset($data->section)) {
                 // Moodle section
                 $type = 'section';
             }
         }
     }
     try {
         $factory = Intuitel::getLOFactory($type);
         return $factory;
     } catch (UnknownLOTypeException $e) {
         $factory = new GenericLOFactory();
         return $factory;
     }
 }