original_string: protected function createSubmodule(StudySubModule $srcSubmodule)
      {
          //First Or new
          $id = $this->SubModuleAlreadyExists($srcSubmodule);
          if ($id != null) {
              $submodule = Submodule::findOrFail($id);
          } else {
              $submodule = new Submodule();
          }
  
          $submodule->name = $srcSubmodule->name;
          $submodule->order = $srcSubmodule->order;
          $submodule->type = $this->mapTypes($srcSubmodule->type->id);
          $submodule->save();
          $submodule->altnames = [
              'shortname'   => $srcSubmodule->shortname,
              'description' => $srcSubmodule->description
          ];
  
          $submodule->addModule($this->getScoolModule());
          return $submodule;
      }
code: protected function createSubmodule(StudySubModule $srcSubmodule)
      {
          //First Or new
          $id = $this->SubModuleAlreadyExists($srcSubmodule);
          if ($id != null) {
              $submodule = Submodule::findOrFail($id);
          } else {
              $submodule = new Submodule();
          }
  
          $submodule->name = $srcSubmodule->name;
          $submodule->order = $srcSubmodule->order;
          $submodule->type = $this->mapTypes($srcSubmodule->type->id);
          $submodule->save();
          $submodule->altnames = [
              'shortname'   => $srcSubmodule->shortname,
              'description' => $srcSubmodule->description
          ];
  
          $submodule->addModule($this->getScoolModule());
          return $submodule;
      }
code_tokens: protected function createSubmodule ( StudySubModule $ srcSubmodule ) { //First Or new $ id = $ this -> SubModuleAlreadyExists ( $ srcSubmodule ) ; if ( $ id != null ) { $ submodule = Submodule :: findOrFail ( $ id ) ; } else { $ submodule = new Submodule ( ) ; } $ submodule -> name = $ srcSubmodule -> name ; $ submodule -> order = $ srcSubmodule -> order ; $ submodule -> type = $ this -> mapTypes ( $ srcSubmodule -> type -> id ) ; $ submodule -> save ( ) ; $ submodule -> altnames = [ 'shortname' => $ srcSubmodule -> shortname , 'description' => $ srcSubmodule -> description ] ; $ submodule -> addModule ( $ this -> getScoolModule ( ) ) ; return $ submodule ; }
docstring: Create scool study submodule using ebre-escool study submodule.
  
  @param StudySubModule $srcSubmodule
  @return ScoolSubmodule
docstring_tokens: Create scool study submodule using ebre - escool study submodule .