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

@@ 151-162 (lines=12) @@
148
     * @throws InvalidArgumentException If the type is not a string (or null).
149
     * @return self
150
     */
151
    public function setType($type)
152
    {
153
        if (is_string($type) || $type === null) {
154
            $this->type = $type;
155
        } else {
156
            throw new InvalidArgumentException(
157
                'Can not set UI item config type: Type must be a string or NULL'
158
            );
159
        }
160
161
        return $this;
162
    }
163
164
    /**
165
     * Retrieve the UI item type.

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

@@ 497-506 (lines=10) @@
494
     * @throws InvalidArgumentException If the key argument is not a string.
495
     * @return FormInterface Chainable
496
     */
497
    public function addFormData($key, $val)
498
    {
499
        if (!is_string($key)) {
500
            throw new InvalidArgumentException(
501
                'Can not add form data: Data key must be a string'
502
            );
503
        }
504
        $this->formData[$key] = $val;
505
506
        return $this;
507
    }
508
509
    /**