is_user_logged_in() ? 403 : 401 ) ); } /** * Schema for a numeric path parameter (a session id). * * @return array */ protected static function id_arg(): array { return array( 'type' => 'integer', 'minimum' => 1, 'required' => true, 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); } /** * Register a route. * * @param string $route Route. * @param array $args Args. */ protected function route( string $route, array $args ): void { register_rest_route( self::NAMESPACE, $route, $args ); } }