Code Duplication    Length = 10-12 lines in 3 locations

src/Charcoal/Ui/UiItemConfig.php 1 location

@@ 46-57 (lines=12) @@
43
     * @throws InvalidArgumentException If the type is not a string.
44
     * @return UiItemConfig Chainable
45
     */
46
    public function setType($type)
47
    {
48
        if (is_string($type) || $type === null) {
49
            $this->type = $type;
50
        } else {
51
            throw new InvalidArgumentException(
52
                'Can not set UI item config type: Type must be a string or NULL'
53
            );
54
        }
55
56
        return $this;
57
    }
58
59
    /**
60
     * Retrieve the UI item type.

src/Charcoal/Ui/UiItemTrait.php 1 location

@@ 120-131 (lines=12) @@
117
     * @throws InvalidArgumentException If the type is not a string.
118
     * @return UiItemInterface Chainable
119
     */
120
    public function setType($type)
121
    {
122
        if (is_string($type) || $type === null) {
123
            $this->type = $type;
124
        } else {
125
            throw new InvalidArgumentException(
126
                'Can not set UI item config type: Type must be a string or NULL'
127
            );
128
        }
129
130
        return $this;
131
    }
132
133
    /**
134
     * Retrieve the UI item type.

src/Charcoal/Ui/Form/FormTrait.php 1 location

@@ 477-486 (lines=10) @@
474
     * @throws InvalidArgumentException If the key argument is not a string.
475
     * @return FormInterface Chainable
476
     */
477
    public function addFormData($key, $val)
478
    {
479
        if (!is_string($key)) {
480
            throw new InvalidArgumentException(
481
                'Can not add form data: Data key must be a string'
482
            );
483
        }
484
        $this->formData[$key] = $val;
485
486
        return $this;
487
    }
488
489
    /**