Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
42 / 42 |
|
100.00% |
17 / 17 |
CRAP | |
100.00% |
1 / 1 |
| Configuration | |
100.00% |
42 / 42 |
|
100.00% |
17 / 17 |
26 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| setApiKey | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getApiKey | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setHost | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getHost | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setRegion | |
100.00% |
13 / 13 |
|
100.00% |
1 / 1 |
10 | |||
| setUserAgent | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getUserAgent | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setDebug | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getDebug | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setDebugFile | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getDebugFile | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setCertFile | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getCertFile | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setKeyFile | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getKeyFile | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toDebugReport | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Configuration. |
| 5 | * |
| 6 | * @category Class |
| 7 | * |
| 8 | * @author OpenAPI Generator team |
| 9 | * |
| 10 | * @see https://openapi-generator.tech |
| 11 | */ |
| 12 | |
| 13 | /** |
| 14 | * Server API. |
| 15 | * |
| 16 | * Fingerprint Server API allows you to get, search, and update Events in a server environment. It can be used for data exports, decision-making, and data analysis scenarios. Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device. |
| 17 | * |
| 18 | * The version of the OpenAPI document: 4 |
| 19 | * Contact: support@fingerprint.com |
| 20 | * Generated by: https://openapi-generator.tech |
| 21 | * Generator version: 7.21.0 |
| 22 | */ |
| 23 | |
| 24 | /** |
| 25 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). |
| 26 | * https://openapi-generator.tech |
| 27 | * Do not edit the class manually. |
| 28 | */ |
| 29 | |
| 30 | namespace Fingerprint\ServerSdk; |
| 31 | |
| 32 | /** |
| 33 | * Configuration Class Doc Comment. |
| 34 | * |
| 35 | * @category Class |
| 36 | * |
| 37 | * @author OpenAPI Generator team |
| 38 | * |
| 39 | * @see https://openapi-generator.tech |
| 40 | */ |
| 41 | class Configuration |
| 42 | { |
| 43 | /** |
| 44 | * Fingerprint PHP Server SDK Version. |
| 45 | */ |
| 46 | public const VERSION = '7.0.0-beta.1'; |
| 47 | |
| 48 | public const REGION_GLOBAL = 'https://api.fpjs.io/v4'; |
| 49 | public const REGION_EUROPE = 'https://eu.api.fpjs.io/v4'; |
| 50 | public const REGION_ASIA = 'https://ap.api.fpjs.io/v4'; |
| 51 | |
| 52 | /** |
| 53 | * Secret API key used for authentication. |
| 54 | */ |
| 55 | protected string $apiKey; |
| 56 | |
| 57 | /** |
| 58 | * The host. |
| 59 | */ |
| 60 | protected string $host = 'https://api.fpjs.io/v4'; |
| 61 | |
| 62 | /** |
| 63 | * User agent of the HTTP request, set to "OpenAPI-Generator/{version}/PHP" by default. |
| 64 | */ |
| 65 | protected string $userAgent = 'fingerprint-php-sdk/7.0.0-beta.1'; |
| 66 | |
| 67 | /** |
| 68 | * Debug switch (default set to false). |
| 69 | */ |
| 70 | protected bool $debug = false; |
| 71 | |
| 72 | /** |
| 73 | * Debug file location (log to STDOUT by default). |
| 74 | */ |
| 75 | protected string $debugFile = 'php://output'; |
| 76 | |
| 77 | /** |
| 78 | * Path to a certificate file, for mTLS. |
| 79 | */ |
| 80 | protected ?string $certFile = null; |
| 81 | |
| 82 | /** |
| 83 | * Path to a key file, for mTLS. |
| 84 | */ |
| 85 | protected ?string $keyFile = null; |
| 86 | |
| 87 | /** |
| 88 | * Constructor. |
| 89 | */ |
| 90 | public function __construct(string $apiKey, ?string $region = self::REGION_GLOBAL) |
| 91 | { |
| 92 | $this->apiKey = $apiKey; |
| 93 | $this->setRegion($region); |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Set the secret API key. |
| 98 | * |
| 99 | * @param string $key the secret API key |
| 100 | * |
| 101 | * @return $this |
| 102 | */ |
| 103 | public function setApiKey(string $key): self |
| 104 | { |
| 105 | $this->apiKey = $key; |
| 106 | |
| 107 | return $this; |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * Get the secret API key. |
| 112 | * |
| 113 | * @return string the secret API key |
| 114 | */ |
| 115 | public function getApiKey(): string |
| 116 | { |
| 117 | return $this->apiKey; |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * Sets the host. |
| 122 | * |
| 123 | * @param string $host Host |
| 124 | * |
| 125 | * @return $this |
| 126 | */ |
| 127 | public function setHost(string $host): self |
| 128 | { |
| 129 | $this->host = $host; |
| 130 | |
| 131 | return $this; |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * Gets the host. |
| 136 | * |
| 137 | * @return string Host |
| 138 | */ |
| 139 | public function getHost(): string |
| 140 | { |
| 141 | return $this->host; |
| 142 | } |
| 143 | |
| 144 | /** |
| 145 | * Sets the region. |
| 146 | * |
| 147 | * @param string|null $region target region |
| 148 | * |
| 149 | * @return $this |
| 150 | */ |
| 151 | public function setRegion(?string $region = self::REGION_GLOBAL): self |
| 152 | { |
| 153 | switch (trim(strtolower($region))) { |
| 154 | case self::REGION_ASIA: |
| 155 | case 'as': |
| 156 | case 'asia': |
| 157 | $this->setHost(self::REGION_ASIA); |
| 158 | |
| 159 | break; |
| 160 | |
| 161 | case self::REGION_EUROPE: |
| 162 | case 'eu': |
| 163 | case 'europe': |
| 164 | $this->setHost(self::REGION_EUROPE); |
| 165 | |
| 166 | break; |
| 167 | |
| 168 | default: |
| 169 | case self::REGION_GLOBAL: |
| 170 | case 'global': |
| 171 | $this->setHost(self::REGION_GLOBAL); |
| 172 | |
| 173 | break; |
| 174 | } |
| 175 | |
| 176 | return $this; |
| 177 | } |
| 178 | |
| 179 | /** |
| 180 | * Sets the user agent of the api client. |
| 181 | * |
| 182 | * @param string $userAgent the user agent of the api client |
| 183 | * |
| 184 | * @return $this |
| 185 | * |
| 186 | * @throws \InvalidArgumentException |
| 187 | */ |
| 188 | public function setUserAgent(string $userAgent): self |
| 189 | { |
| 190 | $this->userAgent = $userAgent; |
| 191 | |
| 192 | return $this; |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * Gets the user agent of the api client. |
| 197 | * |
| 198 | * @return string user agent |
| 199 | */ |
| 200 | public function getUserAgent(): string |
| 201 | { |
| 202 | return $this->userAgent; |
| 203 | } |
| 204 | |
| 205 | /** |
| 206 | * Sets debug flag. |
| 207 | * |
| 208 | * @param bool $debug Debug flag |
| 209 | * |
| 210 | * @return $this |
| 211 | */ |
| 212 | public function setDebug(bool $debug): self |
| 213 | { |
| 214 | $this->debug = $debug; |
| 215 | |
| 216 | return $this; |
| 217 | } |
| 218 | |
| 219 | /** |
| 220 | * Gets the debug flag. |
| 221 | * |
| 222 | */ |
| 223 | public function getDebug(): bool |
| 224 | { |
| 225 | return $this->debug; |
| 226 | } |
| 227 | |
| 228 | /** |
| 229 | * Sets the debug file. |
| 230 | * |
| 231 | * @param string $debugFile Debug file |
| 232 | * |
| 233 | * @return $this |
| 234 | */ |
| 235 | public function setDebugFile(string $debugFile): self |
| 236 | { |
| 237 | $this->debugFile = $debugFile; |
| 238 | |
| 239 | return $this; |
| 240 | } |
| 241 | |
| 242 | /** |
| 243 | * Gets the debug file. |
| 244 | * |
| 245 | */ |
| 246 | public function getDebugFile(): string |
| 247 | { |
| 248 | return $this->debugFile; |
| 249 | } |
| 250 | |
| 251 | /** |
| 252 | * Sets the certificate file path, for mTLS. |
| 253 | * |
| 254 | * @param string $certFile Certificate file path |
| 255 | * |
| 256 | * @return $this |
| 257 | */ |
| 258 | public function setCertFile(string $certFile): self |
| 259 | { |
| 260 | $this->certFile = $certFile; |
| 261 | |
| 262 | return $this; |
| 263 | } |
| 264 | |
| 265 | /** |
| 266 | * Gets the certificate file path, for mTLS. |
| 267 | * |
| 268 | * @return string|null Certificate file path |
| 269 | */ |
| 270 | public function getCertFile(): ?string |
| 271 | { |
| 272 | return $this->certFile; |
| 273 | } |
| 274 | |
| 275 | /** |
| 276 | * Sets the certificate key path, for mTLS. |
| 277 | * |
| 278 | * @return $this |
| 279 | */ |
| 280 | public function setKeyFile(?string $keyFile): self |
| 281 | { |
| 282 | $this->keyFile = $keyFile; |
| 283 | |
| 284 | return $this; |
| 285 | } |
| 286 | |
| 287 | /** |
| 288 | * Gets the certificate key path, for mTLS. |
| 289 | * |
| 290 | * @return string|null Certificate key path |
| 291 | */ |
| 292 | public function getKeyFile(): ?string |
| 293 | { |
| 294 | return $this->keyFile; |
| 295 | } |
| 296 | |
| 297 | /** |
| 298 | * Gets the essential information for debugging. |
| 299 | * |
| 300 | * @return string The report for debugging |
| 301 | */ |
| 302 | public static function toDebugReport(): string |
| 303 | { |
| 304 | $report = 'PHP SDK (Fingerprint\ServerSdk) Debug Report:'.PHP_EOL; |
| 305 | $report .= ' OS: '.php_uname().PHP_EOL; |
| 306 | $report .= ' PHP Version: '.PHP_VERSION.PHP_EOL; |
| 307 | $report .= ' The version of the OpenAPI document: 4'.PHP_EOL; |
| 308 | $report .= ' SDK Package Version: '.self::VERSION.PHP_EOL; |
| 309 | |
| 310 | return $report; |
| 311 | } |
| 312 | } |