Item::description()   A
last analyzed

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
/*
4
 * This file was created by developers working at BitBag
5
 * Do you need more information about us and what we do? Visit our https://bitbag.io website!
6
 * We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7
*/
8
9
declare(strict_types=1);
10
11
namespace BitBag\SyliusElasticsearchPlugin\Controller\Response\DTO;
12
13
final class Item
14
{
15
    /** @var string */
16
    private $taxonName;
17
18
    /** @var string */
19
    private $name;
20
21
    /** @var string */
22
    private $description;
23
24
    /** @var string */
25
    private $slug;
26
27
    /** @var string */
28
    private $price;
29
30
    /** @var string */
31
    private $image;
32
33
    public function __construct(
34
        string $taxonName,
35
        string $name,
36
        ?string $description,
37
        string $slug,
38
        ?string $price,
39
        ?string $image
40
    ) {
41
        $this->taxonName = $taxonName;
42
        $this->name = $name;
43
        $this->description = $description;
44
        $this->slug = $slug;
45
        $this->price = $price;
46
        $this->image = $image;
47
    }
48
49
    public function taxonName(): string
50
    {
51
        return $this->taxonName;
52
    }
53
54
    public function name(): string
55
    {
56
        return $this->name;
57
    }
58
59
    public function description(): ?string
60
    {
61
        return $this->description;
62
    }
63
64
    public function slug(): string
65
    {
66
        return $this->slug;
67
    }
68
69
    public function price(): ?string
70
    {
71
        return $this->price;
72
    }
73
74
    public function image(): ?string
75
    {
76
        return $this->image;
77
    }
78
79
    public function toArray(): array
80
    {
81
        return [
82
            'taxon_name' => $this->taxonName(),
83
            'name' => $this->name(),
84
            'description' => $this->description() ?: '',
85
            'slug' => $this->slug(),
86
            'price' => $this->price(),
87
            'image' => $this->image() ?: '',
88
        ];
89
    }
90
}
91