Code Duplication    Length = 19-20 lines in 2 locations

src/Form/Elements/Tree.php 1 location

@@ 184-202 (lines=19) @@
181
    /**
182
     * @return Model
183
     */
184
    protected function getNodesModel()
185
    {
186
        $model = $this->nodes;
187
188
        if (is_string($model)) {
189
            $model = app($model);
190
        }
191
192
        if (!($model instanceof Model)) {
193
            throw new InvalidArgumentException(
194
                sprintf(
195
                    "Form tree element's nodes class must be instanced of '%s'.",
196
                    Model::class
197
                )
198
            );
199
        }
200
201
        return $model;
202
    }
203
204
    public function getNodesModelLabelAttribute()
205
    {

src/Form/Elements/Select.php 1 location

@@ 144-163 (lines=20) @@
141
    /**
142
     * @return Model
143
     */
144
    public function getOptionsModel()
145
    {
146
        $model = $this->options;
147
148
        if (is_string($model)) {
149
            $model = app($model);
150
        }
151
152
        if (!($model instanceof Model)) {
153
            throw new InvalidArgumentException(
154
                sprintf(
155
                    'Form %s element options class must be instanced of "%s".',
156
                    $this->getType(),
157
                    Model::class
158
                )
159
            );
160
        }
161
162
        return $model;
163
    }
164
165
    /**
166
     * 获取 options 标题字段