Code Duplication    Length = 20-22 lines in 2 locations

src/Queries/ElementQuery.php 1 location

@@ 137-158 (lines=22) @@
134
     *
135
     * @return Collection
136
     */
137
    public function getList()
138
    {
139
        if ($this->queryShouldBeStopped) {
140
            return new Collection();
141
        }
142
143
        $items = [];
144
145
        $rsItems = $this->bxObject->GetList(
146
            $this->sort,
147
            $this->normalizeFilter(),
148
            $this->groupBy,
149
            $this->navigation,
150
            $this->normalizeSelect()
151
        );
152
    
153
        while ($arItem = $rsItems->Fetch()) {
154
            $this->addItemToResultsUsingKeyBy($items, new $this->modelName($arItem['ID'], $arItem));
155
        }
156
157
        return new Collection($items);
158
    }
159
160
    /**
161
     * Get the first element with a given code.

src/Queries/SectionQuery.php 1 location

@@ 80-99 (lines=20) @@
77
     *
78
     * @return Collection
79
     */
80
    public function getList()
81
    {
82
        if ($this->queryShouldBeStopped) {
83
            return new Collection();
84
        }
85
86
        $sections = [];
87
        $rsSections = $this->bxObject->getList(
88
            $this->sort,
89
            $this->normalizeFilter(),
90
            $this->countElements,
91
            $this->normalizeSelect(),
92
            $this->navigation
93
        );
94
        while ($arSection = $rsSections->Fetch()) {
95
            $this->addItemToResultsUsingKeyBy($sections, new $this->modelName($arSection['ID'], $arSection));
96
        }
97
98
        return new Collection($sections);
99
    }
100
101
    /**
102
     * Get the first section with a given code.