Completed
Push — master ( 0b4fa8...bbf19f )
by Andrii
04:44
created

HtmlPage   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 30
ccs 0
cts 16
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 6 1
A renderMiniature() 0 12 2
1
<?php
2
/**
3
 * Yii2 Pages Module
4
 *
5
 * @link      https://github.com/hiqdev/yii2-module-pages
6
 * @package   yii2-module-pages
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2016-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\yii2\modules\pages\models;
12
13
class HtmlPage extends AbstractPage
14
{
15
    /**
16
     * @param array $params
17
     * @return string
18
     */
19
    public function render(array $params = []): string
20
    {
21
        $this->setMetaData();
22
23
        return $this->text;
24
    }
25
26
    /**
27
     * Renders miniature version of page for list
28
     * @return string
29
     */
30
    public function renderMiniature(): string
31
    {
32
        $img = $this->featuredImageUrl ?
33
               "<img src=\"$this->featuredImageUrl\" alt=\"$this->slug\">" :
34
               '';
35
36
        return <<<HTML
37
<h1 class="post-title"><a href="$this->url">$this->title</a></h1>
38
$img
39
$this->text
40
HTML;
41
    }
42
}
43