Passed
Push — master ( 499046...f95177 )
by Leandro
01:22
created

Bag::wearBag()   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 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace ItsMeLePassos\HandBag;
4
5
class Bag
6
{
7
    private string $model;
8
    private string $brand;
9
    private string|null $description;
10
    private string|array $variant;
11
    private string $size;
12
    private string $functionalities;
13
    private float $price;
14
15
    public function setModel(string $model): void
16
    {
17
        $this->model = $model;
18
    }
19
20
    public function setBrand(string $brand): void
21
    {
22
        $this->brand = $brand;
23
    }
24
25
    public function setDescription(string $description): void
26
    {
27
        $this->description = $description;
28
    }
29
30
    public function setVariant(string|array $variant): void
31
    {
32
        $variant = array_filter($variant);
33
        $variant = implode(", ", $variant);
34
        $this->variant = $variant;
35
    }
36
37
    public function setSize(string $size): void
38
    {
39
        $this->size = $size;
40
    }
41
42
    public function setFunctionalities(string $functionalities): void
43
    {
44
        $this->functionalities = $functionalities;
45
    }
46
47
    public function setPrice(float $price): void
48
    {
49
        $this->price = $price;
50
    }
51
52
    /**
53
     * 
54
     * @return string 
55
     */
56
    public function bag(): string
57
    {
58
        $bag = "<h1>Esta é a bolsa {$this->model}, da marca {$this->brand}</h1>";
59
        $bag .= "<p>Descrição: {$this->description}</p><br />";
60
        $bag .= "<p>Está dispoonível nas opções {$this->variant}</p><br />";
61
        $bag .= "<p>Tamanho: {$this->size}</p>";
62
        $bag .= "<p>Funcionalidades: {$this->functionalities}</p><br />";
63
        $bag .= "<p>Preço: {$this->price}</p><br /><br />";
64
        return $bag;
65
    }
66
}
67