= self::seconds(); } /** * Counts from the given moment (default now) instead of the request start; long * CLI runs reset it, and a test backdates it to play a request that ran long. */ public static function restart( ?float $started = null ): void { self::$started = $started ?? microtime( true ); } private static function started(): float { if ( null === self::$started ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- a float PHP itself sets at request start, not a client value; cast to float below. $request = isset( $_SERVER['REQUEST_TIME_FLOAT'] ) ? (float) $_SERVER['REQUEST_TIME_FLOAT'] : 0.0; self::$started = $request > 0 ? $request : microtime( true ); } return self::$started; } }