Completed
Push — development ( 616ff4...ce498d )
by
unknown
15s queued 10s
created

DocumentPhoto::setCountry()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace WeDevBr\Mati\Inputs;
4
5
/**
6
 * Wrapper for identity input
7
 *
8
 * @author Gabriel Mineiro <[email protected]>
9
 */
10
class DocumentPhoto extends BaseInput
11
{
12
    use HasType;
13
14
    protected $group;
15
    protected $country;
16
    protected $region;
17
    protected $page;
18
19
    public function setGroup(int $group): DocumentPhoto
20
    {
21
        $this->group = $group;
22
        return $this;
23
    }
24
25
    public function setCountry(string $country): DocumentPhoto
26
    {
27
        $this->country = $country;
28
        return $this;
29
    }
30
31
    public function setRegion(string $region): DocumentPhoto
32
    {
33
        $this->region = $region;
34
        return $this;
35
    }
36
37
    public function setPage(string $page): DocumentPhoto
38
    {
39
        $this->page = $page;
40
        return $this;
41
    }
42
43
    public function setFilePath(string $path): DocumentPhoto
44
    {
45
        $this->file_path = $path;
46
        return $this;
47
    }
48
49
    public function getFileName(): string
50
    {
51
        return basename($this->file_path);
52
    }
53
54
    public function getFileContents()
55
    {
56
        return file_get_contents($this->file_path);
57
    }
58
59
    public function toArray()
60
    {
61
        return [
62
            'inputType' => 'document-photo',
63
            'group' => $this->group,
64
            'data' => [
65
                'type' => $this->type,
66
                'country' => $this->country,
67
                'region' => $this->region ?? '',
68
                'page' => $this->page,
69
                'filename' => $this->getFileName()
70
            ]
71
        ];
72
    }
73
}
74