Completed
Push — master ( 1e1a94...fe204c )
by Valentyn
05:23
created

MovieTranslationDTO::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2.0078

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 7
cts 8
cp 0.875
rs 9.9
c 0
b 0
f 0
cc 2
nc 2
nop 4
crap 2.0078
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Movies\DTO;
6
7
class MovieTranslationDTO
8
{
9
    private $locale;
10
    private $title;
11
    private $overview;
12
    private $posterUrl;
13
14 5
    public function __construct(string $locale, string $title, ?string $overview, ?string $posterUrl)
15
    {
16 5
        if (mb_strlen($title) >= 100) {
17
            $title = mb_substr($title, 0, 96) . '...';
18
        }
19
20 5
        $this->locale = $locale;
21 5
        $this->title = $title;
22 5
        $this->overview = $overview;
23 5
        $this->posterUrl = $posterUrl;
24 5
    }
25
26
    /**
27
     * @return string
28
     */
29 5
    public function getLocale(): string
30
    {
31 5
        return $this->locale;
32
    }
33
34
    /**
35
     * @return string
36
     */
37 5
    public function getTitle(): string
38
    {
39 5
        return $this->title;
40
    }
41
42
    /**
43
     * @return string|null
44
     */
45 5
    public function getOverview(): ?string
46
    {
47 5
        return $this->overview;
48
    }
49
50
    /**
51
     * @return string|null
52
     */
53 5
    public function getPosterUrl(): ?string
54
    {
55 5
        return $this->posterUrl;
56
    }
57
}
58