Test Setup Failed
Push — master ( dcfdf2...6863da )
by guillaume
16:18 queued 10:15
created

InMemoryFileStorage   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A uriToTmpPicture() 0 5 1
A setContent() 0 3 1
A content() 0 3 1
1
<?php
2
3
4
namespace App\Src\UseCases\Infra\Gateway;
5
6
7
use App\Src\UseCases\Domain\Picture;
8
9
class InMemoryFileStorage implements FileStorage
10
{
11
    private $fs = [];
12
13
    public function setContent(string $path, array $content)
14
    {
15
        $this->fs[$path] = $content;
16
    }
17
18
    public function content(string $path): array
19
    {
20
        return $this->fs[$path];
21
    }
22
23
    public function uriToTmpPicture(string $uri): Picture
24
    {
25
        $path = uniqid();
26
        app(PictureHandler::class)->add($path, 600, 600);
27
        return new Picture($path, $ext = 'jpg');
28
    }
29
30
}
31