1717use Symfony \Component \HttpClient \EventSourceHttpClient ;
1818use Symfony \Contracts \HttpClient \HttpClientInterface ;
1919use Symfony \Contracts \HttpClient \ResponseInterface ;
20- use Webmozart \Assert \Assert ;
2120
2221/**
2322 * @author Christopher Hertel <mail@christopher-hertel.de>
@@ -34,11 +33,11 @@ public function __construct(
3433 #[\SensitiveParameter] private string $ apiKey ,
3534 ) {
3635 $ this ->httpClient = $ httpClient instanceof EventSourceHttpClient ? $ httpClient : new EventSourceHttpClient ($ httpClient );
37- Assert:: notStartsWith ( $ baseUrl , 'http:// ' , 'The base URL must not contain the protocol. ' );
38- Assert:: notStartsWith ( $ baseUrl , 'https:// ' , 'The base URL must not contain the protocol. ' );
39- Assert:: stringNotEmpty ( $ deployment, 'The deployment must not be empty. ' );
40- Assert:: stringNotEmpty ( $ apiVersion, 'The API version must not be empty. ' );
41- Assert:: stringNotEmpty ( $ apiKey, 'The API key must not be empty. ' );
36+ ! str_starts_with ( $ this -> baseUrl , 'http:// ' ) || throw new \ InvalidArgumentException ( 'The base URL must not contain the protocol. ' );
37+ ! str_starts_with ( $ this -> baseUrl , 'https:// ' ) || throw new \ InvalidArgumentException ( 'The base URL must not contain the protocol. ' );
38+ '' !== $ deployment || throw new \ InvalidArgumentException ( 'The deployment must not be empty. ' );
39+ '' !== $ apiVersion || throw new \ InvalidArgumentException ( 'The API version must not be empty. ' );
40+ '' !== $ apiKey || throw new \ InvalidArgumentException ( 'The API key must not be empty. ' );
4241 }
4342
4443 public function supports (Model $ model ): bool
0 commit comments