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);
    }
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);
    }
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 ) ; }
Whether a given module can be enabled
@param string $module_id
@return mixed
@throws UnexpectedValueException
Whether a given module can be enabled