summaryrefslogtreecommitdiffstats
path: root/app/classes/PlanetItem.php
blob: ae97db04130de43c7a7af08a7d2e5376fda06659 (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
33
34
35
36
<?php

/**
 * Planet item
 */

class PlanetItem extends SimplePie_Item
{
    /**
     * @param SimplePie $feed
     * @param string $data
     */
    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;
    }
}