11<?php
2+
23declare (strict_types=1 );
34
45namespace Vonage \Client ;
@@ -28,7 +29,7 @@ class APIResource implements ClientAwareInterface
2829 /**
2930 * @var HandlerInterface[]
3031 */
31- protected array $ authHandler = [];
32+ protected array $ authHandlers = [];
3233
3334 /**
3435 * Base URL that we will hit. This can be overridden from the underlying
@@ -68,8 +69,8 @@ public function addAuth(RequestInterface $request): RequestInterface
6869 {
6970 $ credentials = $ this ->getClient ()->getCredentials ();
7071
71- if (is_array ($ this ->getAuthHandler ())) {
72- foreach ($ this ->getAuthHandler () as $ handler ) {
72+ if (is_array ($ this ->getAuthHandlers ())) {
73+ foreach ($ this ->getAuthHandlers () as $ handler ) {
7374 try {
7475 $ request = $ handler ($ request , $ credentials );
7576 break ;
@@ -84,7 +85,7 @@ public function addAuth(RequestInterface $request): RequestInterface
8485 return $ request ;
8586 }
8687
87- return $ this ->getAuthHandler ()($ request , $ credentials );
88+ return $ this ->getAuthHandlers ()($ request , $ credentials );
8889 }
8990
9091 /**
@@ -106,7 +107,7 @@ public function create(array $body, string $uri = '', array $headers = []): ?arr
106107
107108 $ request ->getBody ()->write (json_encode ($ body ));
108109
109- if ($ this ->getAuthHandler ()) {
110+ if ($ this ->getAuthHandlers ()) {
110111 $ request = $ this ->addAuth ($ request );
111112 }
112113
@@ -154,7 +155,7 @@ public function delete(string $id, array $headers = []): ?array
154155 $ headers
155156 );
156157
157- if ($ this ->getAuthHandler ()) {
158+ if ($ this ->getAuthHandlers ()) {
158159 $ request = $ this ->addAuth ($ request );
159160 }
160161
@@ -207,7 +208,7 @@ public function get($id, array $query = [], array $headers = [], bool $jsonRespo
207208 $ headers
208209 );
209210
210- if ($ this ->getAuthHandler ()) {
211+ if ($ this ->getAuthHandlers ()) {
211212 $ request = $ this ->addAuth ($ request );
212213 }
213214
@@ -231,10 +232,10 @@ public function get($id, array $query = [], array $headers = [], bool $jsonRespo
231232 return json_decode ($ response ->getBody ()->getContents (), true );
232233 }
233234
234- public function getAuthHandler ()
235+ public function getAuthHandlers ()
235236 {
236237 // If we have not set a handler, default to Basic and issue warning.
237- if (!$ this ->authHandler ) {
238+ if (!$ this ->authHandlers ) {
238239 $ this ->log (
239240 LogLevel::WARNING ,
240241 'Warning: no authorisation handler set for this Client. Defaulting to Basic which might not be
@@ -244,7 +245,7 @@ public function getAuthHandler()
244245 return new BasicHandler ();
245246 }
246247
247- return $ this ->authHandler ;
248+ return $ this ->authHandlers ;
248249 }
249250
250251 public function getBaseUrl (): ?string
@@ -352,12 +353,12 @@ public function search(?FilterInterface $filter = null, string $uri = ''): Itera
352353 *
353354 * @return $this
354355 */
355- public function setAuthHandler ($ handler ): self
356+ public function setAuthHandlers ($ handler ): self
356357 {
357358 if (!is_array ($ handler )) {
358359 $ handler = [$ handler ];
359360 }
360- $ this ->authHandler = $ handler ;
361+ $ this ->authHandlers = $ handler ;
361362
362363 return $ this ;
363364 }
@@ -430,7 +431,7 @@ public function submit(array $formData = [], string $uri = '', array $headers =
430431 $ headers
431432 );
432433
433- if ($ this ->getAuthHandler ()) {
434+ if ($ this ->getAuthHandlers ()) {
434435 $ request = $ this ->addAuth ($ request );
435436 }
436437
@@ -473,7 +474,7 @@ protected function updateEntity(string $method, string $id, array $body, array $
473474 $ headers
474475 );
475476
476- if ($ this ->getAuthHandler ()) {
477+ if ($ this ->getAuthHandlers ()) {
477478 $ request = $ this ->addAuth ($ request );
478479 }
479480
0 commit comments