Skip to content

Create ErrorResponse class for error handling#13

Merged
kduma merged 10 commits intomainfrom
claude/create-error-response-class-01SfmpouaEoritbXnontiARn
Nov 23, 2025
Merged

Create ErrorResponse class for error handling#13
kduma merged 10 commits intomainfrom
claude/create-error-response-class-01SfmpouaEoritbXnontiARn

Conversation

@kduma
Copy link
Copy Markdown
Contributor

@kduma kduma commented Nov 23, 2025

  • Create ErrorResponse class implementing Illuminate\Contracts\Support\Responsable
  • Replace errorResponse() and jsonErrorResponse() methods with unified ErrorResponse
  • ErrorResponse automatically detects JSON vs HTML requests using wantsJson()
  • Remove deprecated error response helper methods from SDMController

- Create ErrorResponse class implementing Illuminate\Contracts\Support\Responsable
- Replace errorResponse() and jsonErrorResponse() methods with unified ErrorResponse
- ErrorResponse automatically detects JSON vs HTML requests using wantsJson()
- Remove deprecated error response helper methods from SDMController
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Nov 23, 2025

Coverage report for commit: e8b4f9f
File: coverage.xml

Cover ┌─────────────────────────┐ Freq.
   0% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  10% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  20% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  30% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  40% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  50% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  60% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  70% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  80% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  90% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
 100% │ ███████████████████████ │ 100.0%
      └─────────────────────────┘
 *Legend:* █ = Current Distribution 
Summary - Lines: 100.00% | Methods: 100.00%
FilesLinesMethodsBranches
src/Cipher
   AESCipher.php100.00%100.00%100.00%
   CipherInterface.php100.00%100.00%100.00%
   LRPCipher.php100.00%100.00%100.00%
src
   EncMode.php100.00%100.00%100.00%
   KeyDerivation.php100.00%100.00%100.00%
   ParamMode.php100.00%100.00%100.00%
   SDM.php100.00%100.00%100.00%
   SDMInterface.php100.00%100.00%100.00%
src/Exceptions
   DecryptionException.php100.00%100.00%100.00%
   SDMException.php100.00%100.00%100.00%
   ValidationException.php100.00%100.00%100.00%

🤖 comment via lucassabreu/comment-coverage-clover

claude and others added 9 commits November 23, 2025 20:55
- Create ForceJsonResponseMiddleware to force JSON responses
- Middleware sets Accept header to application/json for all API routes
- Create routes/api.php for API endpoints
- Move API routes from web.php to api.php
- Register API routes with /api prefix in bootstrap/app.php
- Apply ForceJsonResponseMiddleware to all API routes
- API routes now automatically return JSON via wantsJson()
- Create ValidResponse class implementing Responsable
- Automatically converts data format based on request type:
  * JSON: converts binary fields to hex, keeps snake_case keys
  * HTML: converts keys to camelCase, keeps binary as-is
- Replace all view('info', ...) calls with ValidResponse
- Replace all jsonResponse(...) calls with ValidResponse
- Remove jsonResponse() helper method
- Remove JsonResponse import (no longer needed)
- Update return type hints to allow Responsable returns
- Unify data preparation using snake_case format with binary data
- Replace Route::get with Route::view for main page and WebNFC
- Remove index() and webnfc() controller methods
- Remove unused Illuminate\View\View import
- Remove apiTagPlainText, apiTag, apiTagTamper methods
- Remove processEncryptedTagApi method
- Update API routes to use the same controller methods as web routes
- ValidResponse automatically handles JSON vs HTML based on request
- Simplifies controller by removing duplicate code
- Create BaseSDMController with shared SDM methods
  * getSDM(), getMasterKey(), getEncKey(), getMacKey()
- Create TagPlainTextController (invokable) for plain SUN validation
- Create TagController (invokable) for encrypted SUN decryption
  * Includes convertToUtf8() method
  * Protected isTamperTag() method for extension
- Create TagTamperController extending TagController
  * Overrides isTamperTag() to return true
- Update routes to use invokable controllers (ControllerClass::class)
- Remove old monolithic SDMController
- Each controller is focused on a single responsibility
@kduma kduma merged commit f1febb4 into main Nov 23, 2025
2 checks passed
@kduma kduma deleted the claude/create-error-response-class-01SfmpouaEoritbXnontiARn branch November 23, 2025 21:27
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.

2 participants