File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 88
99class Guzzle
1010{
11- const ENDPOINT_PROD = 'https://xivapi.com ' ;
12- const ENDPOINT_DEV = 'https://xivapi.local ' ;
1311 const TIMEOUT = 10.0 ;
1412 const VERIFY = false ;
1513
1614 /** @var Client */
1715 private static $ client = null ;
1816 /** @var bool */
1917 private static $ async = false ;
18+ /** @var string */
19+ private static $ environment = null ;
2020 /** @var array */
2121 private static $ options = [];
2222
@@ -27,12 +27,17 @@ private static function setClient()
2727 {
2828 if (self ::$ client === null ) {
2929 self ::$ client = new Client ([
30- 'base_uri ' => self ::ENDPOINT_PROD ,
30+ 'base_uri ' => self ::$ environment ,
3131 'timeout ' => self ::TIMEOUT ,
3232 'verify ' => self ::VERIFY ,
3333 ]);
3434 }
3535 }
36+
37+ public static function setEnvironment (string $ environment ): void
38+ {
39+ self ::$ environment = $ environment ;
40+ }
3641
3742 public static function query ($ method , $ apiEndpoint , $ options = [])
3843 {
Original file line number Diff line number Diff line change 1717
1818class XIVAPI
1919{
20+ const PROD = 'https://xivapi.com ' ;
21+ const STAGING = 'https://staging.xivapi.com ' ;
22+ const DEV = 'https://xivapi.local ' ;
23+
2024 /** @var Environment */
2125 public $ environment ;
2226 /** @var Search */
@@ -38,8 +42,11 @@ class XIVAPI
3842 /** @var PatchList */
3943 public $ patchlist ;
4044
41- public function __construct ()
45+ public function __construct (string $ environment = self :: PROD )
4246 {
47+ // set environment to use
48+ Guzzle::setEnvironment ($ environment );
49+
4350 $ this ->environment = new Environment ();
4451 $ this ->search = new Search ();
4552 $ this ->content = new Content ();
You can’t perform that action at this time.
0 commit comments