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

BucketLog   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
dl 0
loc 42
rs 10
c 1
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 2 1
A getDate() 0 2 1
A getEventName() 0 2 1
A __construct() 0 5 1
A getExternalId() 0 2 1
A addBucket() 0 2 1
A getBuckets() 0 2 1
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\Fundraising\Frontend\BucketTesting\Domain\Model;
6
7
use DateTime;
8
use DateTimeInterface;
9
use Doctrine\Common\Collections\ArrayCollection;
10
use Doctrine\Common\Collections\Collection;
11
12
class BucketLog {
13
14
	private int $id;
15
	private int $externalId;
16
	private string $eventName;
17
	private Collection $buckets;
18
	private DateTimeInterface $date;
19
20
	public function __construct( int $externalId, string $eventName ) {
21
		$this->externalId = $externalId;
22
		$this->eventName = $eventName;
23
		$this->buckets = new ArrayCollection();
24
		$this->date = new DateTime();
25
	}
26
27
	public function getId(): int {
28
		return $this->id;
29
	}
30
31
	public function getExternalId(): int {
32
		return $this->externalId;
33
	}
34
35
	public function getDate(): DateTimeInterface {
36
		return $this->date;
37
	}
38
39
	public function getEventName(): ?string {
40
		return $this->eventName;
41
	}
42
43
	/**
44
	 * This is only used in tests
45
	 *
46
	 * @return Collection
47
	 */
48
	public function getBuckets(): Collection {
49
		return $this->buckets;
50
	}
51
52
	public function addBucket( BucketLogBucket $bucket ) {
53
		$this->buckets->add( $bucket );
54
	}
55
}
56