1212
1313class Client
1414{
15- private Config $ config ;
15+ private readonly Config $ config ;
1616
1717 private ?Gamma $ gammaClient = null ;
1818
@@ -34,15 +34,15 @@ public function __construct(
3434 ) {
3535 $ this ->config = new Config ($ apiKey , $ options );
3636
37- if ($ gammaHttpClient !== null ) {
37+ if ($ gammaHttpClient instanceof HttpClientInterface ) {
3838 $ this ->gammaClient = new Gamma ($ this ->config , $ gammaHttpClient );
3939 }
4040
41- if ($ clobHttpClient !== null ) {
41+ if ($ clobHttpClient instanceof HttpClientInterface ) {
4242 $ this ->clobClient = new Clob ($ this ->config , $ clobHttpClient );
4343 }
4444
45- if ($ bridgeHttpClient !== null ) {
45+ if ($ bridgeHttpClient instanceof HttpClientInterface ) {
4646 $ this ->bridgeClient = new Bridge ($ this ->config , $ bridgeHttpClient );
4747 }
4848 }
@@ -84,7 +84,7 @@ public function auth(
8484
8585 public function gamma (): Gamma
8686 {
87- if ($ this ->gammaClient === null ) {
87+ if (! $ this ->gammaClient instanceof Gamma ) {
8888 $ this ->gammaClient = new Gamma ($ this ->config );
8989 }
9090
@@ -93,7 +93,7 @@ public function gamma(): Gamma
9393
9494 public function clob (): Clob
9595 {
96- if ($ this ->clobClient === null ) {
96+ if (! $ this ->clobClient instanceof Clob ) {
9797 $ this ->clobClient = new Clob (
9898 $ this ->config ,
9999 null ,
@@ -106,12 +106,10 @@ public function clob(): Clob
106106
107107 /**
108108 * Get Bridge API client for cross-chain deposits.
109- *
110- * @return Bridge
111109 */
112110 public function bridge (): Bridge
113111 {
114- if ($ this ->bridgeClient === null ) {
112+ if (! $ this ->bridgeClient instanceof Bridge ) {
115113 $ this ->bridgeClient = new Bridge ($ this ->config );
116114 }
117115
0 commit comments