model ) ) { return $this->model; } $this->model = wd_di()->get( Two_Fa_Model::class ); return $this->model; } /** * Retrieves the controller instance for two-factor authentication. * * @return Two_Factor The controller instance. */ protected function get_controller(): Two_Factor { return wd_di()->get( Two_Factor::class ); } /** * Retrieves the component instance for two-factor authentication. * * @return Two_Fa_Component The component instance. */ protected function get_component(): Two_Fa_Component { return wd_di()->get( Two_Fa_Component::class ); } /** * Constructs a URL for a specific action related to two-factor authentication. * * @param string $action The action to construct the URL for. * * @return string The constructed URL. */ protected function get_url( $action ): string { $controller = $this->get_controller(); $routes = $controller->dump_routes_and_nonces(); return admin_url( 'admin-ajax.php' ) . sprintf( '?action=%s&route=%s&_def_nonce=%s', defender_base_action(), $controller->check_route( $routes['routes'][ $action ] ), $routes['nonces'][ $action ] ); } }