MemoryTestRepository   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A save() 0 6 1
A load() 0 7 1
1
<?php declare(strict_types = 1);
2
3
namespace TomCizek\SymfonyProoph\Tests\EventSourcing\FakeImplementations;
4
5
use Prooph\EventSourcing\Aggregate\AggregateRepository;
6
use Prooph\EventStore\TransactionalActionEventEmitterEventStore;
7
use Ramsey\Uuid\UuidInterface;
8
9
class MemoryTestRepository extends AggregateRepository implements MemoryTestRepositoryInterface
10
{
11
	/**
12
	 * @var TransactionalActionEventEmitterEventStore
13
	 */
14
	protected $eventStore;
15
16
	public function save(TestAggregateRoot $testAggregateRoot): void
17
	{
18
		$this->eventStore->beginTransaction();
19
		$this->saveAggregateRoot($testAggregateRoot);
20
		$this->eventStore->commit();
21
	}
22
23
	public function load(UuidInterface $uuid): TestAggregateRoot
24
	{
25
		/** @var TestAggregateRoot $testAggregateRoot */
26
		$testAggregateRoot = $this->getAggregateRoot($uuid->toString());
27
28
		return $testAggregateRoot;
29
	}
30
}
31
32