Completed
Push — master ( 33ee7a...35da7e )
by Gabriel
565:17 queued 500:16
created

Bucket::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\Fundraising\Frontend\BucketTesting\Domain\Model;
6
7
class Bucket {
8
	private $name;
9
	private $campaign;
10
	private $defaultBucket;
11
12
	public const DEFAULT = true;
13
	public const NON_DEFAULT = false;
14
15
	public function __construct( string $name, Campaign $campaign, bool $defaultBucket ) {
16
		$this->name = $name;
17
		$this->campaign = $campaign;
18
		$this->defaultBucket = $defaultBucket;
19
	}
20
21
	public function getName(): string {
22
		return $this->name;
23
	}
24
25
	public function getId(): string {
26
		return 'campaigns.' . $this->getCampaign()->getName() . '.' . $this->getName();
27
	}
28
29
	public function getCampaign(): Campaign {
30
		return $this->campaign;
31
	}
32
33
	public function isDefaultBucket(): bool {
34
		return $this->defaultBucket;
35
	}
36
37
	public function getParameters(): array {
38
		return [ $this->campaign->getUrlKey() => $this->campaign->getIndexByBucket( $this ) ];
39
	}
40
41
}
42