| [ 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\HttpTransporterInterface; 8 /** 9 * Trait for a class that implements WithHttpTransporterInterface. 10 * 11 * @since 0.1.0 12 */ 13 trait WithHttpTransporterTrait 14 { 15 /** 16 * @var HttpTransporterInterface|null The HTTP transporter instance. 17 */ 18 private ?HttpTransporterInterface $httpTransporter = null; 19 /** 20 * {@inheritDoc} 21 * 22 * @since 0.1.0 23 */ 24 public function setHttpTransporter(HttpTransporterInterface $httpTransporter): void 25 { 26 $this->httpTransporter = $httpTransporter; 27 } 28 /** 29 * {@inheritDoc} 30 * 31 * @since 0.1.0 32 */ 33 public function getHttpTransporter(): HttpTransporterInterface 34 { 35 if ($this->httpTransporter === null) { 36 throw new RuntimeException('HttpTransporterInterface instance not set. Make sure you use the AiClient class for all requests.'); 37 } 38 return $this->httpTransporter; 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 |