Repository navigation
v2.1.7 — Phase 9.11: HTTP/URL/Support utility extraction
·
67 commits
to epic/refactor-april
since this release
Phase 9.11 — HTTP / URL / Support utility extraction
Seven stateless helpers leave the god-class for dedicated single-responsibility classes under DataFlair\Toplists\Http\ and DataFlair\Toplists\Support\.
New classes
Support\UrlValidator— replacesis_local_url(). Classifies hosts as local-dev (.test,.local,.localhost,.invalid,.example,localhost,127.0.0.1).Support\UrlTransformer— replacesmaybe_force_https(). Rewriteshttp://→https://for non-local URLs.Support\EnvironmentDetector— replacesis_running_in_docker(). Three-way Docker detection.Support\RelativeTimeFormatter— replacestime_ago()+time_until(). "3 minutes ago" / "in 3 minutes" labels.Http\ApiBaseUrlDetector— replacesget_api_base_url(). Three-tier resolution (stored option → endpoints option → fallback).Http\BrandsApiUrlBuilder— replacesget_brands_api_url(). Respectsdataflair_brands_api_version.Http\ApiErrorFormatter— replacesbuild_detailed_api_error(). Status-code switch with admin-UI guidance.
Stats
dataflair-toplists.php: 1,772 → 1,700 LOC.- Tests: 503 → 553 (1,213 assertions), all green.
- 50 new unit tests pin behaviour at the boundary.
Invariants preserved
- Render is still read-only; cron is still removed; HTTPS-force / Docker detection / human-readable error formatting all behave exactly as before.
- The eight extracted god-class methods become one-line delegators — call sites and behaviour unchanged.
- No public option, table, shortcode, AJAX action, or REST route changed.
Branch
This release lives on epic/refactor-april. main is intentionally untouched until end-to-end QA on the epic completes.
Next
Phase 9.12 (v2.1.8) — Shortcode + campaign redirect extraction.
Phase 9.13 (v3.0.0) — God-class symbol removal.