Code Duplication    Length = 11-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

@@ 165-176 (lines=12) @@
162
     * @throws InvalidArgumentException If the type is not a string (or null).
163
     * @return self
164
     */
165
    public function setType($type)
166
    {
167
        if (is_string($type) || $type === null) {
168
            $this->type = $type;
169
        } else {
170
            throw new InvalidArgumentException(
171
                'Can not set UI item config type: Type must be a string or NULL'
172
            );
173
        }
174
175
        return $this;
176
    }
177
178
    /**
179
     * Retrieve the UI item type.

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

@@ 579-589 (lines=11) @@
576
     * @throws InvalidArgumentException If the key argument is not a string.
577
     * @return FormInterface Chainable
578
     */
579
    public function addFormData($key, $val)
580
    {
581
        if (!is_string($key)) {
582
            throw new InvalidArgumentException(
583
                'Can not add form data: Data key must be a string'
584
            );
585
        }
586
        $this->formData[$key] = $val;
587
588
        return $this;
589
    }
590
591
    /**
592
     * @return array