@@ 8-28 (lines=21) @@ | ||
5 | use Carbon\Carbon; |
|
6 | use stdClass; |
|
7 | ||
8 | class MensHockeyParser implements Parser { |
|
9 | ||
10 | public function url() |
|
11 | { |
|
12 | return 'http://www.ritathletics.com/calendar.ashx/calendar.rss?sport_id=9'; |
|
13 | } |
|
14 | ||
15 | public function parse($xml) |
|
16 | { |
|
17 | $homeGame = strpos($xml->title, ' vs ') !== FALSE; |
|
18 | $opponent = substr($xml->title, strpos($xml->title, $homeGame ? 'vs' : 'at') + 2); |
|
19 | ||
20 | $event = new stdClass; |
|
21 | $event->opponent = trim($opponent); |
|
22 | $event->isHome = $homeGame; |
|
23 | $event->startUtc = Carbon::parse($xml->{'ev:startdate'}); |
|
24 | $event->start = Carbon::parse($xml->{'s:localstartdate'}); |
|
25 | $event->url = $xml->link; |
|
26 | return $event; |
|
27 | } |
|
28 | } |
@@ 8-28 (lines=21) @@ | ||
5 | use Carbon\Carbon; |
|
6 | use stdClass; |
|
7 | ||
8 | class WomensHockeyParser implements Parser { |
|
9 | ||
10 | public function url() |
|
11 | { |
|
12 | return 'http://www.ritathletics.com/calendar.ashx/calendar.rss?sport_id=10'; |
|
13 | } |
|
14 | ||
15 | public function parse($xml) |
|
16 | { |
|
17 | $homeGame = strpos($xml->title, ' vs ') !== FALSE; |
|
18 | $opponent = substr($xml->title, strpos($xml->title, $homeGame ? 'vs' : 'at') + 2); |
|
19 | ||
20 | $event = new stdClass; |
|
21 | $event->opponent = trim($opponent); |
|
22 | $event->isHome = $homeGame; |
|
23 | $event->startUtc = Carbon::parse($xml->{'ev:startdate'}); |
|
24 | $event->start = Carbon::parse($xml->{'s:localstartdate'}); |
|
25 | $event->url = $xml->link; |
|
26 | return $event; |
|
27 | } |
|
28 | } |