Code Duplication    Length = 33-34 lines in 3 locations

src/eXpansion/Framework/Config/Ui/Fields/MaskedField.php 1 location

@@ 17-50 (lines=34) @@
14
 * @copyright 2018 eXpansion
15
 * @package eXpansion\Framework\Config\Ui
16
 */
17
class MaskedField implements UiInterface
18
{
19
    /** @var Factory */
20
    protected $uiFactory;
21
22
    /**
23
     * TextField constructor.
24
     *
25
     * @param Factory $uiFactory
26
     */
27
    public function __construct(Factory $uiFactory)
28
    {
29
        $this->uiFactory = $uiFactory;
30
    }
31
32
    /**
33
     * @inheritdoc
34
     */
35
    public function build(ConfigInterface $config, $width): Renderable
36
    {
37
        return $this
38
            ->uiFactory
39
            ->createInputMasked($config->getPath(), $config->getRawValue())
40
            ->setWidth($width);
41
    }
42
43
    /**
44
     * @inheritdoc
45
     */
46
    public function isCompatible(ConfigInterface $config): bool
47
    {
48
         return ($config instanceof PasswordConfig);
49
    }
50
}
51

src/eXpansion/Framework/Config/Ui/Fields/TextAreaField.php 1 location

@@ 16-48 (lines=33) @@
13
 * @copyright 2018 eXpansion
14
 * @package eXpansion\Framework\Config\Ui
15
 */
16
class TextAreaField implements UiInterface
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

src/eXpansion/Framework/Config/Ui/Fields/TextField.php 1 location

@@ 17-50 (lines=34) @@
14
 * @copyright 2018 eXpansion
15
 * @package eXpansion\Framework\Config\Ui
16
 */
17
class TextField implements UiInterface
18
{
19
    /** @var Factory */
20
    protected $uiFactory;
21
22
    /**
23
     * TextField constructor.
24
     *
25
     * @param Factory $uiFactory
26
     */
27
    public function __construct(Factory $uiFactory)
28
    {
29
        $this->uiFactory = $uiFactory;
30
    }
31
32
    /**
33
     * @inheritdoc
34
     */
35
    public function build(ConfigInterface $config, $width): Renderable
36
    {
37
        return $this
38
            ->uiFactory
39
            ->createInput($config->getPath(), $config->getRawValue())
40
            ->setWidth($width);
41
    }
42
43
    /**
44
     * @inheritdoc
45
     */
46
    public function isCompatible(ConfigInterface $config): bool
47
    {
48
        return ($config instanceof AbstractConfig);
49
    }
50
}
51