ContentBlock   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 32
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getBlockSummary() 0 3 1
A getPlain() 0 3 1
1
<?php
2
3
namespace Cita\Modular\Model;
4
5
use SilverStripe\View\Parsers\ShortcodeParser;
6
use SilverStripe\ORM\FieldType\DBHTMLText;
7
8
class ContentBlock extends Block
9
{
10
    /**
11
     * Defines the database table name
12
     *  @var string
13
     */
14
    private static $table_name = 'Cita_Modular_ContentBlock';
15
16
    private static $icon_class = 'font-icon-block-content';
17
18
    /**
19
     * Singular name for CMS
20
     *  @var string
21
     */
22
    private static $singular_name = 'Content block';
23
24
    /**
25
     * Database fields
26
     * @var array
27
     */
28
    private static $db = [
29
        'Content' => 'HTMLText',
30
    ];
31
32
    public function getPlain()
33
    {
34
        return "<h2>" . $this->Title . "</h2>" . $this->Content;
35
    }
36
37
    public function getBlockSummary()
38
    {
39
        return DBHTMLText::create()->setValue(strip_tags(ShortcodeParser::get_active()->parse($this->Content)))->Summary(15);
40
    }
41
}
42