Completed
Pull Request — master (#280)
by
unknown
03:35
created

TextAreaField::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 6
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 6
loc 6
ccs 0
cts 3
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 2
crap 2
1
<?php
2
3
namespace eXpansion\Framework\Config\Ui\Fields;
4
5
use eXpansion\Framework\Config\Model\ConfigInterface;
6
use eXpansion\Framework\Gui\Ui\Factory;
7
use FML\Types\Renderable;
8
9
/**
10
 * Class TextAreaField
11
 *
12
 * @author    reaby
13
 * @copyright 2018 eXpansion
14
 * @package eXpansion\Framework\Config\Ui
15
 */
16 View Code Duplication
class TextAreaField implements UiInterface
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...
17
{
18
    /** @var Factory */
19
    protected $uiFactory;
20
21
    /**
22
     * TextField constructor.
23
     *
24
     * @param Factory $uiFactory
25
     */
26
    public function __construct(Factory $uiFactory)
27
    {
28
        $this->uiFactory = $uiFactory;
29
    }
30
31
    /**
32
     * @inheritdoc
33
     */
34
    public function build(ConfigInterface $config, $width): Renderable
35
    {
36
        return $this
37
            ->uiFactory
38
            ->createTextbox($config->getPath(), $config->getRawValue(), 5, $width);
39
    }
40
41
    /**
42
     * @inheritdoc
43
     */
44
    public function isCompatible(ConfigInterface $config): bool
45
    {
46
        return ($config instanceof TextAreaField);
47
    }
48
}
49