Code Duplication    Length = 21-21 lines in 2 locations

source/Spiral/ORM/Entities/RecordSelector.php 2 locations

@@ 226-246 (lines=21) @@
223
     *
224
     * @return $this
225
     */
226
    public function load($relation, array $options = [])
227
    {
228
        if (is_array($relation)) {
229
            foreach ($relation as $name => $subOption) {
230
                if (is_string($subOption)) {
231
                    //Array of relation names
232
                    $this->load($subOption, $options);
233
                } else {
234
                    //Multiple relations or relation with addition load options
235
                    $this->load($name, $subOption + $options);
236
                }
237
            }
238
239
            return $this;
240
        }
241
242
        //We are requesting primary loaded to pre-load nested relation
243
        $this->loader->loader($relation, $options);
244
245
        return $this;
246
    }
247
248
    /**
249
     * With method is very similar to load() one, except it will always include related data to
@@ 323-343 (lines=21) @@
320
     *
321
     * @return $this
322
     */
323
    public function with($relation, array $options = [])
324
    {
325
        if (is_array($relation)) {
326
            foreach ($relation as $name => $options) {
327
                if (is_string($options)) {
328
                    //Array of relation names
329
                    $this->with($options, []);
330
                } else {
331
                    //Multiple relations or relation with addition load options
332
                    $this->with($name, $options);
333
                }
334
            }
335
336
            return $this;
337
        }
338
339
        //Requesting primary loader to join nested relation, will only work for ORM loaders
340
        $this->loader->joiner($relation, $options);
341
342
        return $this;
343
    }
344
345
    /**
346
     * Fetch one record from database using it's primary key. You can use INLOAD and JOIN_ONLY