Skip to content

Commit

Permalink
docs: update descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
tyiuhc committed Jan 8, 2024
1 parent b6bfd50 commit a0d7a11
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
12 changes: 8 additions & 4 deletions src/Amplitude/AmplitudeConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace AmplitudeExperiment\Amplitude;

use AmplitudeExperiment\Assignment\AssignmentConfig;
use AmplitudeExperiment\Assignment\AssignmentConfigBuilder;
use AmplitudeExperiment\Http\FetchClientInterface;

/**
* Configuration options for Amplitude. This is an object that can be created using
* a {@link AmplitudeConfigBuilder}. Example usage:
*
* AmplitudeConfigBuilder::builder()->serverZone("EU")->build();
* Configuration options for Amplitude. The Amplitude object is created when you create an {@link AssignmentConfig}.
* Options should be set using {@link AssignmentConfigBuilder}.
*/
class AmplitudeConfig
{
Expand All @@ -33,9 +33,13 @@ class AmplitudeConfig
* True to use batch API endpoint, False to use HTTP V2 API endpoint.
*/
public bool $useBatch;
/**
* The underlying HTTP client to use for requests, if this is not set, the default {@link GuzzleFetchClient} will be used.
*/
public ?FetchClientInterface $fetchClient;
/**
* @var array<string, mixed>
* The configuration for the underlying default {@link GuzzleFetchClient} client (if used). See {@link GUZZLE_DEFAULTS} for defaults.
*/
public array $guzzleClientConfig;

Expand Down
16 changes: 14 additions & 2 deletions src/Assignment/AssignmentConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,27 @@

/**
* Configuration options for assignment tracking. This is an object that can be created using
* a {@link AssignmentConfigBuilder}. Example usage:
* a {@link AssignmentConfigBuilder}, which also sets options for {@link AmplitudeConfig}. Example usage:
*
* AssignmentConfigBuilder::builder('api-key')->build()
* ```
* AssignmentConfigBuilder::builder('api-key')->minIdLength(10)->build();
* ```
*/

class AssignmentConfig
{
/**
* The Amplitude Analytics API key.
*/
public string $apiKey;
/**
* The maximum number of assignments stored in the assignment cache
*/
public int $cacheCapacity;
/**
* Configuration options for the underlying {@link Amplitude} client. This is created when
* calling {@link AssignmentConfigBuilder::build()} and does not need to be explicitly set.
*/
public AmplitudeConfig $amplitudeConfig;

const DEFAULTS = [
Expand Down
14 changes: 11 additions & 3 deletions src/Local/LocalEvaluationConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,22 @@
use AmplitudeExperiment\Logger\LogLevel;
use Psr\Log\LoggerInterface;

/**
* Configuration options. This is an object that can be created using
* a {@link LocalEvaluationConfigBuilder}. Example usage:
*
*```
* LocalEvaluationConfig::builder()->serverUrl("https://api.lab.amplitude.com/")->build();
* ```
*/
class LocalEvaluationConfig
{
/**
* Set to use custom logger. If not set, a {@link DefaultLogger} is used.
*/
public ?LoggerInterface $logger;
/**
* The log level to use for the logger.
* The {@link LogLevel} to use for the logger.
*/
public int $logLevel;
/**
Expand All @@ -29,12 +37,12 @@ class LocalEvaluationConfig
public array $bootstrap;
public ?AssignmentConfig $assignmentConfig;
/**
* The underlying HTTP client to use for requests, if this is not set, the default GuzzleFetchClient will be used.
* The underlying HTTP client to use for requests, if this is not set, the default {@link GuzzleFetchClient} will be used.
*/
public ?FetchClientInterface $fetchClient;
/**
* @var array<string, mixed>
* The configuration for the underlying default Guzzle client. See {@link GUZZLE_DEFAULTS} for defaults.
* The configuration for the underlying default {@link GuzzleFetchClient} client (if used). See {@link GUZZLE_DEFAULTS} for defaults.
*/
public array $guzzleClientConfig;

Expand Down
10 changes: 6 additions & 4 deletions src/Remote/RemoteEvaluationConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
* Configuration options. This is an object that can be created using
* a {@link RemoteEvaluationConfigBuilder}. Example usage:
*
*`RemoteEvaluationConfig::builder()->serverUrl("https://api.lab.amplitude.com/")->build()`
*```
* RemoteEvaluationConfig::builder()->serverUrl("https://api.lab.amplitude.com/")->build();
* ```
*/
class RemoteEvaluationConfig
{
Expand All @@ -20,20 +22,20 @@ class RemoteEvaluationConfig
*/
public ?LoggerInterface $logger;
/**
* The log level to use for the logger.
* The {@link LogLevel} to use for the logger.
*/
public int $logLevel;
/**
* The server endpoint from which to request variants.
*/
public string $serverUrl;
/**
* The underlying HTTP client to use for requests, if this is not set, the default GuzzleFetchClient will be used.
* The underlying HTTP client to use for requests, if this is not set, the default {@link GuzzleFetchClient} will be used.
*/
public ?FetchClientInterface $fetchClient;
/**
* @var array<string, mixed>
* The configuration for the underlying default Guzzle client. See {@link GUZZLE_DEFAULTS} for defaults.
* The configuration for the underlying default {@link GuzzleFetchClient} (if used). See {@link GUZZLE_DEFAULTS} for defaults.
*/
public array $guzzleClientConfig;

Expand Down

0 comments on commit a0d7a11

Please sign in to comment.