Completed
Push — master ( 4e2c55...2c21d8 )
by Andrey
01:28
created

FieldTypeTextArea   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 85 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 17
loc 20
rs 10
c 0
b 0
f 0
wmc 1
lcom 1
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 12 14 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Itstructure\FieldWidgets;
4
5
use yii\helpers\{ArrayHelper, Html};
6
7
/**
8
 * Class FieldTypeTextArea
9
 * Class for printing a text block of a form.
10
 *
11
 * @package Itstructure\FieldWidgets
12
 */
13 View Code Duplication
class FieldTypeTextArea extends FieldType
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
{
15
    /**
16
     * @return string
17
     */
18
    public function run(): string
19
    {
20
        return $this->getField()
21
            ->textarea(
22
                ArrayHelper::merge(
23
                    [
24
                        'rows' => 10,
25
                        'cols' => 80
26
                    ],
27
                    $this->getOptions()
28
                )
29
            )
30
            ->label($this->getLabel());
31
    }
32
}
33