Completed
Pull Request — master (#294)
by De Cramer
03:48
created

TextAreaField::getRawValueFromEntry()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
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\Core\Model\Gui\ManialinkInterface;
7
use eXpansion\Framework\Core\Plugins\Gui\ManialinkFactory;
8
use eXpansion\Framework\Gui\Ui\Factory;
9
use FML\Types\Renderable;
10
11
/**
12
 * Class TextAreaField
13
 *
14
 * @author    reaby
15
 * @copyright 2018 eXpansion
16
 * @package eXpansion\Framework\Config\Ui
17
 */
18 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...
19
{
20
    /** @var Factory */
21
    protected $uiFactory;
22
23
    /**
24
     * TextField constructor.
25
     *
26
     * @param Factory $uiFactory
27
     */
28
    public function __construct(Factory $uiFactory)
29
    {
30
        $this->uiFactory = $uiFactory;
31
    }
32
33
    /**
34
     * @inheritdoc
35
     */
36
    public function build(ConfigInterface $config, $width, ManialinkInterface $manialink, ManialinkFactory $manialinkFactory): Renderable
37
    {
38
        return $this
39
            ->uiFactory
40
            ->createTextbox($config->getPath(), $config->getRawValue(), 5, $width);
41
    }
42
43
    /**
44
     * @inheritdoc
45
     */
46
    public function isCompatible(ConfigInterface $config): bool
47
    {
48
        return ($config instanceof TextAreaField);
49
    }
50
51
    /**
52
     * Get raw value to set from gui entry data.
53
     *
54
     * @param ConfigInterface $config
55
     * @param                 $entry
56
     *
57
     * @return mixed
58
     */
59
    public function getRawValueFromEntry(ConfigInterface $config, $entry)
60
    {
61
        return $entry;
62
    }
63
}
64