original_string: public function loadData($installModel)
      {
  
          $this->is_active = false;
          $this->create_at = new Expression('NOW()'); // server time
          $this->module_id = $installModel->moduleId;
          $this->parent_uid = $installModel->parentUid;
  
          $fileBody = file_get_contents($installModel->moduleClassFile->tempName);
  
          //$regexp = "/namespace[ \t]+([A-Za-z0-9\\_]+);/"; //??
          $regexp = "/namespace[ \t]+([^;]+);/";
          $n = preg_match($regexp, $fileBody, $found);
          if ($n < 1) {
              $this->addError('module_class', $error = Yii::t($this->tc, "Can't find namespace in module class file"));
              return;
          } else {
              $this->module_class = $found[1] . "\\" . basename($installModel->moduleClassFile->name, '.php');
              $cmd = "return {$this->module_class}::className();";
              if(function_exists('runkit_lint') && !runkit_lint($cmd)) {
                  $this->addError('module_class', $error = Yii::t($this->tc, 'Module class file has errors'));
                  return;
              }
  //*??
              try {
                  $className = @eval($cmd);
                  if ($className != $this->module_class) {
                      $this->addError('module_class', $error = Yii::t($this->tc, 'Bad module class file'));
                      return;
                  }
              } catch (Exception $e) { // not catch syntax error
                  $this->addError('module_class', $error = Yii::t($this->tc, $e->getMessage()));
                  return;
              }
  /**/
              $configDefault = $this->buildDefaultConfig($this->module_class);
              $this->config_default = var_export($configDefault, true);
  
              $this->name = empty($configDefault['params']['label'])
                  ? ('Module ' . dirname($this->module_class))
                  : $configDefault['params']['label'];
  
              $config = [];
              if (isset($configDefault['params'])) {
                  $config['params'] = $configDefault['params'];
              }
              if (isset($configDefault['routesConfig'])) {
                  $config['routesConfig'] = $configDefault['routesConfig'];
              } else {
                  //$config['routesConfig'] = []; //!! error if not-UniModule
              }
              $this->config_text = var_export($config, true);
  
          }
      }
code: public function loadData($installModel)
      {
  
          $this->is_active = false;
          $this->create_at = new Expression('NOW()'); // server time
          $this->module_id = $installModel->moduleId;
          $this->parent_uid = $installModel->parentUid;
  
          $fileBody = file_get_contents($installModel->moduleClassFile->tempName);
  
          //$regexp = "/namespace[ \t]+([A-Za-z0-9\\_]+);/"; //??
          $regexp = "/namespace[ \t]+([^;]+);/";
          $n = preg_match($regexp, $fileBody, $found);
          if ($n < 1) {
              $this->addError('module_class', $error = Yii::t($this->tc, "Can't find namespace in module class file"));
              return;
          } else {
              $this->module_class = $found[1] . "\\" . basename($installModel->moduleClassFile->name, '.php');
              $cmd = "return {$this->module_class}::className();";
              if(function_exists('runkit_lint') && !runkit_lint($cmd)) {
                  $this->addError('module_class', $error = Yii::t($this->tc, 'Module class file has errors'));
                  return;
              }
  //*??
              try {
                  $className = @eval($cmd);
                  if ($className != $this->module_class) {
                      $this->addError('module_class', $error = Yii::t($this->tc, 'Bad module class file'));
                      return;
                  }
              } catch (Exception $e) { // not catch syntax error
                  $this->addError('module_class', $error = Yii::t($this->tc, $e->getMessage()));
                  return;
              }
  /**/
              $configDefault = $this->buildDefaultConfig($this->module_class);
              $this->config_default = var_export($configDefault, true);
  
              $this->name = empty($configDefault['params']['label'])
                  ? ('Module ' . dirname($this->module_class))
                  : $configDefault['params']['label'];
  
              $config = [];
              if (isset($configDefault['params'])) {
                  $config['params'] = $configDefault['params'];
              }
              if (isset($configDefault['routesConfig'])) {
                  $config['routesConfig'] = $configDefault['routesConfig'];
              } else {
                  //$config['routesConfig'] = []; //!! error if not-UniModule
              }
              $this->config_text = var_export($config, true);
  
          }
      }
code_tokens: public function loadData ( $ installModel ) { $ this -> is_active = false ; $ this -> create_at = new Expression ( 'NOW()' ) ; // server time $ this -> module_id = $ installModel -> moduleId ; $ this -> parent_uid = $ installModel -> parentUid ; $ fileBody = file_get_contents ( $ installModel -> moduleClassFile -> tempName ) ; //$regexp = "/namespace[ \t]+([A-Za-z0-9\\_]+);/"; //?? $ regexp = "/namespace[ \t]+([^;]+);/" ; $ n = preg_match ( $ regexp , $ fileBody , $ found ) ; if ( $ n < 1 ) { $ this -> addError ( 'module_class' , $ error = Yii :: t ( $ this -> tc , "Can't find namespace in module class file" ) ) ; return ; } else { $ this -> module_class = $ found [ 1 ] . "\\" . basename ( $ installModel -> moduleClassFile -> name , '.php' ) ; $ cmd = "return {$this->module_class}::className();" ; if ( function_exists ( 'runkit_lint' ) && ! runkit_lint ( $ cmd ) ) { $ this -> addError ( 'module_class' , $ error = Yii :: t ( $ this -> tc , 'Module class file has errors' ) ) ; return ; } //*?? try { $ className = @ eval ( $ cmd ) ; if ( $ className != $ this -> module_class ) { $ this -> addError ( 'module_class' , $ error = Yii :: t ( $ this -> tc , 'Bad module class file' ) ) ; return ; } } catch ( Exception $ e ) { // not catch syntax error $ this -> addError ( 'module_class' , $ error = Yii :: t ( $ this -> tc , $ e -> getMessage ( ) ) ) ; return ; } /**/ $ configDefault = $ this -> buildDefaultConfig ( $ this -> module_class ) ; $ this -> config_default = var_export ( $ configDefault , true ) ; $ this -> name = empty ( $ configDefault [ 'params' ] [ 'label' ] ) ? ( 'Module ' . dirname ( $ this -> module_class ) ) : $ configDefault [ 'params' ] [ 'label' ] ; $ config = [ ] ; if ( isset ( $ configDefault [ 'params' ] ) ) { $ config [ 'params' ] = $ configDefault [ 'params' ] ; } if ( isset ( $ configDefault [ 'routesConfig' ] ) ) { $ config [ 'routesConfig' ] = $ configDefault [ 'routesConfig' ] ; } else { //$config['routesConfig'] = []; //!! error if not-UniModule } $ this -> config_text = var_export ( $ config , true ) ; } }
docstring: Load data from install model
docstring_tokens: Load data from install model