options_helper = $options_helper; $this->scheduler = $scheduler; $this->populate_file_command_handler = $populate_file_command_handler; $this->remove_file_command_handler = $remove_file_command_handler; } /** * Registers the hooks with WordPress. * * @return void */ public function register_hooks() { \add_action( Llms_Txt_Cron_Scheduler::LLMS_TXT_POPULATION, [ $this, 'populate_file', ] ); } /** * Populates and creates the file. * * @return void */ public function populate_file(): void { if ( ! \wp_doing_cron() ) { return; } if ( $this->options_helper->get( 'enable_llms_txt', false ) !== true ) { $this->scheduler->unschedule_llms_txt_population(); $this->remove_file_command_handler->handle(); return; } $this->populate_file_command_handler->handle(); } }