@@ -22,6 +22,7 @@ final class Client implements ClientInterface
2222 private array $ router = array ();
2323 private readonly OperationsInterface $ operations ;
2424 private readonly Hydrators $ hydrators ;
25+ private readonly Routers $ routers ;
2526 public function __construct (\ApiClients \Contracts \HTTP \Headers \AuthenticationInterface $ authentication , \React \Http \Browser $ browser )
2627 {
2728 $ this ->authentication = $ authentication ;
@@ -30,6 +31,7 @@ public function __construct(\ApiClients\Contracts\HTTP\Headers\AuthenticationInt
3031 $ this ->responseSchemaValidator = new \League \OpenAPIValidation \Schema \SchemaValidator (\League \OpenAPIValidation \Schema \SchemaValidator::VALIDATE_AS_RESPONSE );
3132 $ this ->hydrators = new Hydrators ();
3233 $ this ->operations = new Operations (browser: $ this ->browser , authentication: $ this ->authentication , requestSchemaValidator: $ this ->requestSchemaValidator , responseSchemaValidator: $ this ->responseSchemaValidator , hydrators: $ this ->hydrators );
34+ $ this ->routers = new Routers (browser: $ this ->browser , authentication: $ this ->authentication , requestSchemaValidator: $ this ->requestSchemaValidator , responseSchemaValidator: $ this ->responseSchemaValidator , hydrators: $ this ->hydrators );
3335 }
3436 // phpcs:disable
3537 /**
@@ -44,31 +46,31 @@ public function call(string $call, array $params = array()) : iterable|\ApiClien
4446 if ($ method === 'GET ' ) {
4547 if ($ pathChunksCount === 2 ) {
4648 if (\array_key_exists (Router \Get \Two::class, $ this ->router ) == false ) {
47- $ this ->router [Router \Get \Two::class] = new Router \Get \Two (browser : $ this ->browser , authentication: $ this -> authentication , requestSchemaValidator: $ this -> requestSchemaValidator , responseSchemaValidator: $ this -> responseSchemaValidator , hydrators: $ this -> hydrators );
49+ $ this ->router [Router \Get \Two::class] = new Router \Get \Two (routers : $ this ->routers );
4850 }
4951 return $ this ->router [Router \Get \Two::class]->call ($ call , $ params , $ pathChunks );
5052 } elseif ($ pathChunksCount === 3 ) {
5153 if (\array_key_exists (Router \Get \Three::class, $ this ->router ) == false ) {
52- $ this ->router [Router \Get \Three::class] = new Router \Get \Three (browser : $ this ->browser , authentication: $ this -> authentication , requestSchemaValidator: $ this -> requestSchemaValidator , responseSchemaValidator: $ this -> responseSchemaValidator , hydrators: $ this -> hydrators );
54+ $ this ->router [Router \Get \Three::class] = new Router \Get \Three (routers : $ this ->routers );
5355 }
5456 return $ this ->router [Router \Get \Three::class]->call ($ call , $ params , $ pathChunks );
5557 }
5658 } elseif ($ method === 'LIST ' ) {
5759 if ($ pathChunksCount === 2 ) {
5860 if (\array_key_exists (Router \List \Two::class, $ this ->router ) == false ) {
59- $ this ->router [Router \List \Two::class] = new Router \List \Two (browser : $ this ->browser , authentication: $ this -> authentication , requestSchemaValidator: $ this -> requestSchemaValidator , responseSchemaValidator: $ this -> responseSchemaValidator , hydrators: $ this -> hydrators );
61+ $ this ->router [Router \List \Two::class] = new Router \List \Two (routers : $ this ->routers );
6062 }
6163 return $ this ->router [Router \List \Two::class]->call ($ call , $ params , $ pathChunks );
6264 } elseif ($ pathChunksCount === 3 ) {
6365 if (\array_key_exists (Router \List \Three::class, $ this ->router ) == false ) {
64- $ this ->router [Router \List \Three::class] = new Router \List \Three (browser : $ this ->browser , authentication: $ this -> authentication , requestSchemaValidator: $ this -> requestSchemaValidator , responseSchemaValidator: $ this -> responseSchemaValidator , hydrators: $ this -> hydrators );
66+ $ this ->router [Router \List \Three::class] = new Router \List \Three (routers : $ this ->routers );
6567 }
6668 return $ this ->router [Router \List \Three::class]->call ($ call , $ params , $ pathChunks );
6769 }
6870 } elseif ($ method === 'POST ' ) {
6971 if ($ pathChunksCount === 2 ) {
7072 if (\array_key_exists (Router \Post \Two::class, $ this ->router ) == false ) {
71- $ this ->router [Router \Post \Two::class] = new Router \Post \Two (browser : $ this ->browser , authentication: $ this -> authentication , requestSchemaValidator: $ this -> requestSchemaValidator , responseSchemaValidator: $ this -> responseSchemaValidator , hydrators: $ this -> hydrators );
73+ $ this ->router [Router \Post \Two::class] = new Router \Post \Two (routers : $ this ->routers );
7274 }
7375 return $ this ->router [Router \Post \Two::class]->call ($ call , $ params , $ pathChunks );
7476 }
0 commit comments