original_string: public function canEnable($module_id)
      {
          if ($this->module->isEnabled($module_id)) {
              throw new UnexpectedValueException($this->translation->text('Module already installed and enabled'));
          }
  
          if ($this->module->isLocked($module_id)) {
              throw new UnexpectedValueException($this->translation->text('Module is locked in code'));
          }
  
          if ($this->module->isInstaller($module_id)) {
              $error = $this->translation->text('Modules with "installer" type cannot be installed/enabled when system is already set up');
              throw new UnexpectedValueException($error);
          }
  
          $this->module->getInstance($module_id); // Test module class
          return $this->checkRequirements($module_id);
      }
code: public function canEnable($module_id)
      {
          if ($this->module->isEnabled($module_id)) {
              throw new UnexpectedValueException($this->translation->text('Module already installed and enabled'));
          }
  
          if ($this->module->isLocked($module_id)) {
              throw new UnexpectedValueException($this->translation->text('Module is locked in code'));
          }
  
          if ($this->module->isInstaller($module_id)) {
              $error = $this->translation->text('Modules with "installer" type cannot be installed/enabled when system is already set up');
              throw new UnexpectedValueException($error);
          }
  
          $this->module->getInstance($module_id); // Test module class
          return $this->checkRequirements($module_id);
      }
code_tokens: public function canEnable ( $ module_id ) { if ( $ this -> module -> isEnabled ( $ module_id ) ) { throw new UnexpectedValueException ( $ this -> translation -> text ( 'Module already installed and enabled' ) ) ; } if ( $ this -> module -> isLocked ( $ module_id ) ) { throw new UnexpectedValueException ( $ this -> translation -> text ( 'Module is locked in code' ) ) ; } if ( $ this -> module -> isInstaller ( $ module_id ) ) { $ error = $ this -> translation -> text ( 'Modules with "installer" type cannot be installed/enabled when system is already set up' ) ; throw new UnexpectedValueException ( $ error ) ; } $ this -> module -> getInstance ( $ module_id ) ; // Test module class return $ this -> checkRequirements ( $ module_id ) ; }
docstring: Whether a given module can be enabled
  @param string $module_id
  @return mixed
  @throws UnexpectedValueException
docstring_tokens: Whether a given module can be enabled