Page   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 34
rs 10
wmc 4

1 Method

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