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

@@ 132-151 (lines=20) @@
129
    /**
130
     * @return Model
131
     */
132
    public function getOptionsModel()
133
    {
134
        $model = $this->options;
135
136
        if (is_string($model)) {
137
            $model = app($model);
138
        }
139
140
        if (!($model instanceof Model)) {
141
            throw new InvalidArgumentException(
142
                sprintf(
143
                    'Form %s element options class must be instanced of "%s".',
144
                    $this->getType(),
145
                    Model::class
146
                )
147
            );
148
        }
149
150
        return $model;
151
    }
152
153
    /**
154
     * 获取 options 标题字段