<commit_before><?php
/**
 * @author         <NAME> <<EMAIL>>
 * @copyright      (c) 2016-2018, <NAME>. All Rights Reserved.
 * @license        GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
 * @package        PH7 / App / System / Module / Admin / From / Processing
 */

namespace PH7;

defined('PH7') or exit('Restricted access');

use PH7\Framework\Cache\Cache;
use PH7\Framework\Mvc\Model\Module as ModuleModel;

class DisableModuleFormProcess extends Form
{
    public function __construct()
    {
        parent::__construct();

        $oModuleModel = new ModuleModel;

        // First, disable all mods as uncheckboxes elements aren't send through the form
        $this->disableMods($oModuleModel);

        // Then, enable the mods selected to be enabled
        foreach ($this->httpRequest->post('module_id') as $iModId) {
            $oModuleModel->update($iModId, '1'); // Need to be string because in DB it's an "enum" type
        }
        unset($oModuleModel);

        $this->clearCache();

        \PFBC\Form::setSuccess('form_module', t('Module Status saved!'));
    }

    protected function disableMods(ModuleModel $oModuleModel)
    {
        foreach ($oModuleModel->get() as $oMod) {
            // Need to be string because in DB it's an "enum" type
            $oModuleModel->update($oMod->moduleId, '0');
        }
    }

    private function clearCache()
    {
        (new Cache)->start(ModuleModel::CACHE_GROUP, null, null)->clear();
    }
}<commit_msg>Method only used in its own class; Change visibility to private<commit_after><?php
/**
 * @author         <NAME> <<EMAIL>>
 * @copyright      (c) 2016-2018, <NAME>. All Rights Reserved.
 * @license        GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
 * @package        PH7 / App / System / Module / Admin / From / Processing
 */

namespace PH7;

defined('PH7') or exit('Restricted access');

use PH7\Framework\Cache\Cache;
use PH7\Framework\Mvc\Model\Module as ModuleModel;

class DisableModuleFormProcess extends Form
{
    public function __construct()
    {
        parent::__construct();

        $oModuleModel = new ModuleModel;

        // First, disable all mods as uncheckboxes elements aren't send through the form
        $this->disableMods($oModuleModel);

        // Then, enable the mods selected to be enabled
        foreach ($this->httpRequest->post('module_id') as $iModId) {
            $oModuleModel->update($iModId, '1'); // Need to be string because in DB it's an "enum" type
        }
        unset($oModuleModel);

        $this->clearCache();

        \PFBC\Form::setSuccess('form_module', t('Module Status saved!'));
    }

    private function disableMods(ModuleModel $oModuleModel)
    {
        foreach ($oModuleModel->get() as $oMod) {
            // Need to be string because in DB it's an "enum" type
            $oModuleModel->update($oMod->moduleId, '0');
        }
    }

    private function clearCache()
    {
        (new Cache)->start(ModuleModel::CACHE_GROUP, null, null)->clear();
    }
}
{'fraction_non_alphanumeric': 0.12661082474226804, 'fraction_numerical': 0.01095360824742268, 'mean_word_length': 2.6745562130177514, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2147788', 'n_tokens_mistral': 922, 'n_tokens_neox': 886, 'n_words': 264}