summaryrefslogtreecommitdiffstats
path: root/common/app/classes/PlanetItem.php
blob: 039d0ca4c8478496d7577c28a9be4c3971565c15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

/**
 * Planet item
 */

class PlanetItem
{
    public function __construct($feed, $data)
    {
        parent::SimplePie_Item($feed, $data);
    }

    public function compare($item1, $item2)
    {
        $item1_date = $item1->get_date('U');
        $item2_date = $item2->get_date('U');

        if ($item1_date == $item2_date) {
            return 0;
        } elseif ($item1_date < $item2_date) {
            return 1;
        }

        return -1;
    }
}