Beispiel #1
1
 public static function api($row_raw)
 {
     if (empty($row_raw)) {
         return array();
     }
     if ($row_raw instanceof self) {
         $row_raw = $row_raw->toArray();
     }
     $row = array('id' => (int) $row_raw['id'], 'station_id' => (int) $row_raw['station_id'], 'guid' => $row_raw['guid'], 'start_time' => (int) $row_raw['start_time'], 'end_time' => (int) $row_raw['end_time'], 'is_all_day' => (bool) $row_raw['is_all_day'], 'title' => $row_raw['title'], 'location' => $row_raw['location'], 'body' => $row_raw['body'], 'banner_url' => $row_raw['banner_url'], 'web_url' => $row_raw['web_url'], 'range' => $row_raw['range'] ?: self::getRangeText($row_raw['start_time'], $row_raw['end_time'], $row_raw['is_all_day']), 'image_url' => \PVL\Url::upload(self::getRowImageUrl($row_raw)));
     if (isset($row_raw['minutes_until'])) {
         $row['minutes_until'] = (int) $row_raw['minutes_until'];
     }
     // Add station shortcode.
     if (isset($row_raw['station'])) {
         $row['station'] = Station::api($row_raw['station']);
         $shortcode = Station::getStationShortName($row_raw['station']['name']);
         $row['station_shortcode'] = $shortcode;
     }
     return $row;
 }