summaryrefslogtreecommitdiffstats
path: root/app/classes/PlanetItem.php
blob: 7d55781b70dd555b720d8f1ddf0f8fd40f0cbfd2 (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
28
29
30
31
32
<?php

/**
 * Planet item
 */

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

    /**
     * @param PlanetItem $item1
     * @param PlanetItem $item2
     * @return int
     */
    public static 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;
    }
}