Video   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 2
Metric Value
eloc 13
c 4
b 0
f 2
dl 0
loc 39
rs 10
wmc 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 29 5
1
<?php declare(strict_types=1);
2
3
namespace One\Model;
4
5
use One\Collection;
6
7
class Video extends Model
8
{
9
    /**
10
     * constructor
11
     *
12
     * @param \Psr\Http\Message\UriInterface|string $source
13
     * @param integer $order
14
     * @param \Psr\Http\Message\UriInterface|string $cover
15
     * @param string $lead
16
     */
17
    public function __construct(
18
        string $body,
19
        $source,
20
        $order,
21
        $cover = null,
22
        $lead = '',
23
        $duration = null,
24
        $ratio = ''
25
    ) {
26
        $properties = [
27
            'lead' => empty($lead) ? $this->createLeadFromBody($body) : $this->filterStringInstance($lead),
28
            'body' => $this->filterStringInstance($body),
29
            'order' => $order,
30
            'duration' => $duration
31
        ];
32
33
        if (! empty($source)) {
34
            $properties['source'] = $this->filterUriInstance($source);
35
        }
36
37
        if (! empty($cover)) {
38
            $properties['cover'] = $this->filterUriInstance($cover);
39
        }
40
41
        if (! empty($ratio)) {
42
            $properties['ratio'] = $this->filterStringInstance($ratio);
43
        }
44
45
        $this->collection = new Collection($properties);
46
    }
47
}
48