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

MovieTranslationDTO   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 93.75%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 0
dl 0
loc 51
ccs 15
cts 16
cp 0.9375
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 2
A getLocale() 0 4 1
A getTitle() 0 4 1
A getOverview() 0 4 1
A getPosterUrl() 0 4 1
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