| Total Complexity | 5 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class Visitor { |
||
| 11 | |||
| 12 | private $totalImpressionCount = 0; |
||
| 13 | private $bucketIdentifier; |
||
| 14 | private $activeCategories; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @param int $totalImpressionCount How many banners the visitor has seen overall |
||
| 18 | * @param string|null $bucketIdentifier Last bucket identifier of the visitor (to put recurring visitors in the same buckets, but only per-campaign) |
||
| 19 | * @param string ...$activeCategories Categories the user has interacted with (close button, donation, etc) |
||
| 20 | */ |
||
| 21 | public function __construct( int $totalImpressionCount, ?string $bucketIdentifier, string ...$activeCategories ) { |
||
| 22 | $this->totalImpressionCount = $totalImpressionCount; |
||
| 23 | $this->bucketIdentifier = $bucketIdentifier; |
||
| 24 | $this->activeCategories = $activeCategories; |
||
| 25 | } |
||
| 26 | |||
| 27 | public function getTotalImpressionCount(): int { |
||
| 28 | return $this->totalImpressionCount; |
||
| 29 | } |
||
| 30 | |||
| 31 | public function getBucketIdentifier(): ?string { |
||
| 33 | } |
||
| 34 | |||
| 35 | public function inCategory( string $categoryName ): bool { |
||
| 36 | return in_array( $categoryName, $this->activeCategories, true ); |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @return string[] |
||
| 41 | */ |
||
| 42 | public function getCategories(): array { |
||
| 44 | } |
||
| 45 | } |