Code Duplication    Length = 3-7 lines in 2 locations

src/Collection.php 2 locations

@@ 531-537 (lines=7) @@
528
        $this->callHandlers($this->baseEntityHandlers, array(&$this->query));
529
530
        // Check if sorter is configured
531
        if (count($this->sorter)) {
532
            // If we need to sort by entity own field(column)
533
            if (in_array($this->sorter['field'], $class::$_attributes)) {
534
                // Add material entity sorter
535
                $this->query->orderBy($this->sorter['field'], $this->sorter['destination']);
536
            }
537
        }
538
539
        // Perform main entity query
540
        $this->materialIDs = $this->query
@@ 563-565 (lines=3) @@
560
        // If no filters is set
561
        if (!count($this->search) && !count($this->navigation) && !count($this->field)) {
562
            // Add sorting if present for material table
563
            if (count($this->sorter) && !array_key_exists('enitity', $this->sorter)) {
564
                $this->query->orderBy($this->sorter['field'], $this->sorter['destination']);
565
            }
566
            // Get all entity records identifiers
567
            $this->materialIDs = $this->query->where('Active', 1)->where('system', 0)->fields($class::$_primary);
568
        }