<commit_before><?hh

class SettingsController extends BaseController {
  public static function getPath(): string {
    return '/settings';
  }

  public static function getConfig(): ControllerConfig {
    return
      (new ControllerConfig())->setUserRoles(Vector {UserRole::Superuser});
  }

  public static function get(): :xhp {
    $settings = Map {
      'applications_open' => Settings::get('applications_open'),
    };

    return
      <x:js-scope>
        <nucleus:settings settings={$settings} />
      </x:js-scope>;
  }

  public static function post(): void {
    if (isset($_POST['applications_disabled'])) {
      Settings::set('applications_open', false);
    } else {
      Settings::set('applications_open', true);
    }

    Route::redirect('/settings');
  }<commit_msg>Move Settings to addCheck config syntax<commit_after><?hh

class SettingsController extends BaseController {
  public static function getPath(): string {
    return '/settings';
  }

  public static function getConfig(): ControllerConfig {
    return (new ControllerConfig())->addCheck(
      Auth::requireRoles(Vector {UserRole::Superuser}),
    );
  }

  public static function get(): :xhp {
    $settings = Map {
      'applications_open' => Settings::get('applications_open'),
    };

    return
      <x:js-scope>
        <nucleus:settings settings={$settings} />
      </x:js-scope>;
  }

  public static function post(): void {
    if (isset($_POST['applications_disabled'])) {
      Settings::set('applications_open', false);
    } else {
      Settings::set('applications_open', true);
    }

    Route::redirect(self::getPath());
  }
{'fraction_non_alphanumeric': 0.14451928965094918, 'fraction_numerical': 0.0, 'mean_word_length': 3.551532033426184, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '4208773', 'n_tokens_mistral': 469, 'n_tokens_neox': 455, 'n_words': 102}