Text   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 3
dl 0
loc 28
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A processData() 0 4 1
1
<?php
2
3
namespace app\models\types;
4
5
use Yii;
6
use app\models\ContentType;
7
use yii\helpers\Html;
8
9
/**
10
 * This is the model class for Text content type.
11
 */
12
class Text extends ContentType
13
{
14
    public $html = '<span class="text bigtext">%data%</span>';
15
    public $css = '%field% { text-align: center; vertical-align: middle; }';
16
    public $input = 'text';
17
    public $output = 'text';
18
    public $usable = true;
19
    public $exemple = '@web/images/text.preview.jpg';
20
    public $canPreview = true;
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function __construct($config = [])
26
    {
27
        parent::__construct($config);
28
        $this->name = Yii::t('app', 'Text');
29
        $this->description = Yii::t('app', 'Textual content, will be adjusted to be displayed as big as possible.');
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function processData($data)
36
    {
37
        return nl2br(Html::encode($data));
38
    }
39
}
40