Skip to content

feat(#121): create RequestProcessor class#129

Merged
usernane merged 1 commit into
devfrom
refactor/121-create-request-processor
Jun 1, 2026
Merged

feat(#121): create RequestProcessor class#129
usernane merged 1 commit into
devfrom
refactor/121-create-request-processor

Conversation

@usernane

@usernane usernane commented Jun 1, 2026

Copy link
Copy Markdown
Member

Summary

Create a RequestProcessor class that processes a single web service against an HTTP request without requiring manual service registration or a full WebServicesManager setup. Step 4 of 5 in ADR-0005.

Motivation

Processing a WebService currently requires instantiating a full WebServicesManager with its registry. The RequestProcessor provides a simpler entry point when the caller already knows which service to invoke. Fixes #121.

Changes

  • Created WebFiori\Http\RequestProcessor with process(WebService $service, ?Request $request, $outputStream) method
  • Leverages WebServicesManager internally (single-service auto-select mode)
  • Added example in examples/04-advanced/04-request-processor/

UI Changes

N/A

How to Test / Verify

php vendor/bin/phpunit tests/WebFiori/Tests/Http/RequestProcessorTest.php

6 new tests, 11 assertions. Full suite: 530 tests pass.

Breaking Changes and Migration Steps

None. New class — purely additive.

Checklist

  • I reviewed my own diff before requesting review
  • My commits follow Conventional Commits
  • The title of the pull request follows Conventional Commits
  • I added/updated tests (or explained why not)
  • I updated docs (if needed)
  • I ran lint/cs-fixer (if applicable)
  • I considered backward compatibility
  • I considered security

Related issues

Closes #121
Part of ADR-0005: https://github.com/WebFiori/docs/blob/main/adr/0005-request-processor-replaces-manager.md

- Add RequestProcessor for standalone service processing without a manager
- Accepts WebService + optional Request + optional output stream
- Handles full pipeline: content type, method check, params, auth, invocation
- Internally uses WebServicesManager (single-service auto-select)
- Add example in examples/04-advanced/04-request-processor/
- 6 new tests covering GET, POST, auth denial, method not allowed, content type
- Step 4 of 5 in ADR-0005 (RequestProcessor refactor)
@sonarqubecloud

sonarqubecloud Bot commented Jun 1, 2026

Copy link
Copy Markdown

@usernane usernane merged commit 7810da5 into dev Jun 1, 2026
3 checks passed
@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.64%. Comparing base (baae969) to head (d06f00e).
⚠️ Report is 2 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##                dev     #129   +/-   ##
=========================================
  Coverage     93.64%   93.64%           
  Complexity     1316     1316           
=========================================
  Files            39       39           
  Lines          3180     3180           
=========================================
  Hits           2978     2978           
  Misses          202      202           
Flag Coverage Δ
php-8.3 93.64% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant