Code Duplication    Length = 3-7 lines in 2 locations

src/Collection.php 2 locations

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