Skip to content

Commit e4f33d7

Browse files
committed
refactor: split ZammadClient into three concerns (ClientFactory, ImpersonationHandler, slim client)
Split the monolithic ZammadClient into focused classes: - ClientFactory → GuzzleClientFactory implements ClientFactoryInterface Guzzle wiring lives exclusively in GuzzleClientFactory::buildClient() Non-Guzzle via new ZammadClient(new RequestHandler(...)) - ImpersonationHandler — stateless decorator implementing RequestHandlerInterface. Injects From header on every request including getRaw(). No shared mutable state. - ZammadClient — slimmed from ~210 to ~79 lines. Only repo() and getHandler(). Repository access via typed, explicit, IDE-friendly methods (ticket(), user(), group(), etc.) implemented directly on the class. Removals and cleanups: - __call, aliasMap, resolveAlias — replaced by explicit typed methods - RequestHandler:: — shared mutable state removed - RequestHandlerInterface::setOnBehalfOfUser/getOnBehalfOfUser — removed - RequestHandlerInterface::getRaw() extended with $headers parameter for ImpersonationHandler compatibility - onBehalfOf() / performOnBehalfOf() — not a Client concern; use new ZammadClient(new ImpersonationHandler($handler, $userId)) - getListKey() default $this->resourcePath; 10 identical impls removed Namespace structure: Core/Contracts/ — ClientInterface, ClientFactoryInterface Core/Repository/ — AbstractRepository, RepositoryRegistry, PaginatedList, Resource, ResponseParser, DtoHydrator Core/Transport/ — RequestHandler, RetryAfterMiddleware, ImpersonationHandler, HttpPageFetcher Core/Traits/ — RepositoryAccessors (opt-in for custom ClientInterface impls), HasTimestamps, HydratesFromArray, SerializesToArray Factory/ — GuzzleClientFactory Bug fixes: - HttpPageFetcher::extractIndexResults() now reads total_count from API response instead of hard-coding null
1 parent 83c29f2 commit e4f33d7

53 files changed

Lines changed: 656 additions & 1189 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
/.phpunit.cache/
33
/composer.lock
44
/build/
5+
/.opencode/
6+
/playground.php

0 commit comments

Comments
 (0)