Code Duplication    Length = 21-21 lines in 2 locations

code/control/PageRaterExtension_Controller.php 1 location

@@ 238-258 (lines=21) @@
235
     *
236
     * @return ArrayList
237
     */
238
    protected function turnPageRaterSQLIntoArrayList($data, $method = "unknown")
239
    {
240
        if ($data instanceof SQLQuery) {
241
            $data = $data->execute();
242
        }
243
        $al = new ArrayList();
244
        if ($data) {
245
            foreach ($data as $record) {
246
                if ($record instanceof PageRating) {
247
                    $record->Method = $method;
248
                    //do nothing
249
                } else {
250
                    $score = $record["RatingAverage"];
251
                    $parentID = $record["ParentID"];
252
                    $record = PageRating::get_star_details_as_array_data($score, $parentID, $method);
253
                }
254
                $al->push($record);
255
            }
256
        }
257
        return $al;
258
    }
259
260
    /**
261
     * @return boolean

code/model/PageRaterExtension.php 1 location

@@ 203-223 (lines=21) @@
200
     *
201
     * @return ArrayList
202
     */
203
    public function turnPageRaterSQLIntoArrayList($data, $method = "unknown")
204
    {
205
        if ($data instanceof SQLQuery) {
206
            $data = $data->execute();
207
        }
208
        $al = new ArrayList();
209
        if ($data) {
210
            foreach ($data as $record) {
211
                if ($record instanceof PageRating) {
212
                    $record->Method = $method;
213
                    //do nothing
214
                } else {
215
                    $score = $record["RatingAverage"];
216
                    $parentID = $record["ParentID"];
217
                    $record = PageRating::get_star_details_as_array_data($score, $parentID, $method);
218
                }
219
                $al->push($record);
220
            }
221
        }
222
        return $al;
223
    }
224
225
    public function onlyShowApprovedPageRatings()
226
    {