Code Duplication    Length = 19-20 lines in 2 locations

src/Form/Elements/Tree.php 1 location

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

src/Form/Elements/Select.php 1 location

@@ 153-172 (lines=20) @@
150
    /**
151
     * @return Model
152
     */
153
    public function getOptionsModel()
154
    {
155
        $model = $this->options;
156
157
        if (is_string($model)) {
158
            $model = app($model);
159
        }
160
161
        if (!($model instanceof Model)) {
162
            throw new InvalidArgumentException(
163
                sprintf(
164
                    'Form %s element options class must be instanced of "%s".',
165
                    $this->getType(),
166
                    Model::class
167
                )
168
            );
169
        }
170
171
        return $model;
172
    }
173
174
    /**
175
     * 获取 options 标题字段