Extracted credential validation, request building, response parsing, and configuration helpers from the 464-line OpenRouter provider into separate, focused classes. This follows the pattern established by the Cloudflare image provider and brings all files under the project's 300-line limit. Files created: - class-open-router-validator.php (152 lines): Handles credential validation with HTTP probes and diagnostic messaging. Delegates from the provider. - class-open-router-config.php (84 lines): Centralizes admin config resolution for API base URL and cache TTL settings. Used by both provider and validator. - class-open-router-request-builder.php (79 lines): Encapsulates request header building and cURL auth filter registration for hosting environments that strip Authorization headers. - class-open-router-response-parser.php (87 lines): Handles response parsing, error classification, and retry-decision logic. - Tests: OpenRouterValidatorTest.php with comprehensive credential checks. Provider shrinks from 464 to 278 lines. All classes are under 300 lines. Dependencies remain clean: validator and config are independent, request-builder and response-parser have no circular imports. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
9.4 KiB
9.4 KiB