Passed
Push — master ( 1ffd02...b93f0b )
by Bertrand
06:21
created

InMemoryContextRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 12
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 3 1
A getByUser() 0 3 1
1
<?php
2
3
4
namespace App\Src\UseCases\Infra\InMemory;
5
6
7
use App\Src\UseCases\Domain\Agricultural\Model\Context;
8
use App\Src\UseCases\Domain\Ports\ContextRepository;
9
10
class InMemoryContextRepository implements ContextRepository
11
{
12
    private $exploitations = [];
13
14
    public function add(Context $exploitation, string $userId)
15
    {
16
        $this->exploitations[$userId] = $exploitation;
17
    }
18
19
    public function getByUser(string $userId)
20
    {
21
        return $this->exploitations[$userId] ?? null;
22
    }
23
24
}
25