| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 3 declare (strict_types=1); 4 namespace WordPress\AiClient\Providers\Http\Traits; 5 6 use WordPress\AiClient\Common\Exception\RuntimeException; 7 use WordPress\AiClient\Providers\Http\Contracts\RequestAuthenticationInterface; 8 /** 9 * Trait for a class that implements WithRequestAuthenticationInterface. 10 * 11 * @since 0.1.0 12 */ 13 trait WithRequestAuthenticationTrait 14 { 15 /** 16 * @var RequestAuthenticationInterface|null The request authentication instance. 17 */ 18 private ?RequestAuthenticationInterface $requestAuthentication = null; 19 /** 20 * {@inheritDoc} 21 * 22 * @since 0.1.0 23 */ 24 public function setRequestAuthentication(RequestAuthenticationInterface $requestAuthentication): void 25 { 26 $this->requestAuthentication = $requestAuthentication; 27 } 28 /** 29 * {@inheritDoc} 30 * 31 * @since 0.1.0 32 */ 33 public function getRequestAuthentication(): RequestAuthenticationInterface 34 { 35 if ($this->requestAuthentication === null) { 36 throw new RuntimeException('RequestAuthenticationInterface instance not set. ' . 'Make sure you use the AiClient class for all requests.'); 37 } 38 return $this->requestAuthentication; 39 } 40 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Sat Jun 13 09:38:55 2026 | Cross-referenced by PHPXref |