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

InMemoryContextRepository::getByUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
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