Constructor

Learn how to initialize an in-memory identity store.

The constructor initializes the store with a client ID and user token.

Both are optional, so it can start empty.

Signature

The constructor has the following signature:

public function __construct(?Uuid $clientId = null, ?Token $userToken = null)

Example

Here is a basic example of how to seed an in-memory identity store for a test:

<?phpuse Croct\Plug\InMemoryIdentityStore;use Croct\Plug\Uuid;
$storage = new InMemoryIdentityStore(    clientId: Uuid::parse('f47ac10b-58cc-4372-a567-0e02b2c3d479'),);

Parameters

The following list describes the supported parameters:

clientId(optional)
Uuid|null

The visitor’s client ID. The default is null, which starts with no client ID.

Default:null
userToken(optional)
Token|null

The visitor’s user token. The default is null, which starts with no user token.

Default:null