PluginAnonsTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A addAnonsToModule() 0 12 1
1
<?php
2
3
namespace Larrock\Core\Plugins;
4
5
use Larrock\Core\Helpers\FormBuilder\FormCheckbox;
6
use Larrock\Core\Helpers\FormBuilder\FormTextarea;
7
8
trait PluginAnonsTrait
9
{
10
    /**
11
     * Плагин для генерации анонса новости для блока анонс новости.
12
     * @param int $categoryAnons    ID категории с анонсами
13
     * @return $this
14
     */
15
    public function addAnonsToModule($categoryAnons)
16
    {
17
        $row = new FormCheckbox('anons_merge', 'Сгенерировать для анонса заголовок и ссылку на новость');
18
        $this->rows['anons_merge'] = $rows_plugin[] = $row->setTab('anons', 'Создать анонс');
0 ignored issues
show
Comprehensibility Best Practice introduced by
$rows_plugin was never initialized. Although not strictly required by PHP, it is generally a good practice to add $rows_plugin = array(); before regardless.
Loading history...
Bug Best Practice introduced by
The property rows does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
19
20
        $row = new FormTextarea('anons_description', 'Текст для анонса новости в модуле');
21
        $this->rows['anons_description'] = $rows_plugin[] = $row->setTab('anons', 'Создать анонс')->setTypo();
22
23
        $this->settings['anons_category'] = $categoryAnons;
0 ignored issues
show
Bug Best Practice introduced by
The property settings does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
24
        $this->plugins_backend['anons']['rows'] = $rows_plugin;
0 ignored issues
show
Bug Best Practice introduced by
The property plugins_backend does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
25
26
        return $this;
27
    }
28
}
29