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

HtmlPage::renderMiniature()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 12
c 0
b 0
f 0
ccs 0
cts 11
cp 0
rs 9.8666
cc 2
nc 2
nop 0
crap 6
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