<?php
 declare(strict_types=1); namespace Square\Http; class HttpCallBack { private $onBeforeRequest = null; private $onAfterRequest = null; public function __construct(?callable $onBeforeRequest = null, ?callable $onAfterRequest = null) { $this->onBeforeRequest = $onBeforeRequest; $this->onAfterRequest = $onAfterRequest; } public function setOnBeforeRequest(callable $func): void { $this->onBeforeRequest = $func; } public function getOnBeforeRequest(): callable { return $this->onBeforeRequest; } public function setOnAfterRequest(callable $func): void { $this->onAfterRequest = $func; } public function getOnAfterRequest(): callable { return $this->onAfterRequest; } public function callOnBeforeRequest(HttpRequest $httpRequest): void { if ($this->onBeforeRequest != null) { call_user_func($this->onBeforeRequest, $httpRequest); } } public function callOnAfterRequest(HttpContext $httpContext): void { if ($this->onAfterRequest != null) { call_user_func($this->onAfterRequest, $httpContext); } } } 