<commit_before><?php

class HomeAPIModule extends APIModule
{
    protected $id = 'home';
    protected $vmin = 1;
    protected $vmax = 1;

    public function initializeForCommand() {
        $this->invalidCommand();
    }
}

<commit_msg>added notice api to home module<commit_after><?php

class HomeAPIModule extends APIModule
{
    protected $id = 'home';
    protected $vmin = 1;
    protected $vmax = 1;

    public function initializeForCommand() {
        switch ($this->command)
        {
            case 'notice':
                $response = null;
                $responseVersion = 1;
                $notice = $this->getOptionalModuleSection('notice');
                if ($notice) {
                    $bannerNotice = null;
                    // notice can either take a module or data model class or retriever class. The section is passed on. It must implement the HomeAlertInterface interface
                    if (isset($notice['MODULE'])) {
                        $moduleID = $notice['MODULE'];
                        $controller = WebModule::factory($moduleID);
                    } elseif (isset($notice['MODEL_CLASS'])) {
                        $controller = DataModel::factory($notice['MODEL_CLASS'], $notice);
                    } elseif (isset($notice['RETRIEVER_CLASS'])) {
                        $controller = DataRetriever::factory($notice['RETRIEVER_CLASS'], $notice);
                    }
    
                    if (!$controller instanceOf HomeAlertInterface) {
                        throw new KurogoConfigurationException("Module $moduleID does not implement HomeAlertModule interface");
                    } 
    
                    if ($bannerNotice = $controller->getHomeScreenAlert()) {
                        $response = $bannerNotice;
                    }
                }

                $this->setResponse($response);
                $this->setResponseVersion($responseVersion);
                break;
            default:
                $this->invalidCommand();
        }
    }
}


{'fraction_non_alphanumeric': 0.10479921645445642, 'fraction_numerical': 0.002448579823702253, 'mean_word_length': 1.6532467532467532, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, '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': '2956869', 'n_tokens_mistral': 502, 'n_tokens_neox': 476, 'n_words': 117}