-
Notifications
You must be signed in to change notification settings - Fork 39
/
SegmentContract.php
44 lines (31 loc) · 1.37 KB
/
SegmentContract.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace App\Contracts;
use App\CampaignSegment;
use Illuminate\Support\Collection;
interface SegmentContract
{
const CACHE_TAG = 'segment';
public function list(): Collection;
public function checkUser(CampaignSegment $campaignSegment, string $userId): bool;
public function checkBrowser(CampaignSegment $campaignSegment, string $browserId): bool;
public function users(CampaignSegment $campaignSegment): Collection;
public function provider(): string;
public function cacheEnabled(CampaignSegment $campaignSegment): bool;
public function addUserToCache(CampaignSegment $campaignSegment, string $userId): bool;
public function removeUserFromCache(CampaignSegment $campaignSegment, string $userId): bool;
/**
* setCache stores and provides cache object for campaign segment providers.
*
* @param $cache \stdClass Array of objects keyed by name of the segment provider. Internals
* of the stored object is defined by contract of provider itself
* and not subject of validation here.
*/
public function setProviderData($cache): void;
/**
* getProviderData returns internal per-provider data objects to be stored
* by third party and possibly provided later via *setCache()* call.
*
* @return \stdClass
*/
public function getProviderData();
}