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
                } else {
249
                    $score = $record["RatingAverage"];
250
                    $parentID = $record["ParentID"];
251
                    $record = PageRating::get_star_details_as_array_data($score, $parentID, $method);
252
                }
253
                $al->push($record);
254
            }
255
        }
256
        return $al;
257
    }
258
259
    /**
260
     * @return boolean
261
     */

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
                } else {
214
                    $score = $record["RatingAverage"];
215
                    $parentID = $record["ParentID"];
216
                    $record = PageRating::get_star_details_as_array_data($score, $parentID, $method);
217
                }
218
                $al->push($record);
219
            }
220
        }
221
        return $al;
222
    }
223
224
    public function onlyShowApprovedPageRatings()
225
    {
226
        return Config::inst()->get("PageRaterExtension_Controller", "only_show_approved");