public function getTweets(&$contents, $tid) { $images = Tweet::getRelated(); foreach ($images as $image) { $data = $image->toArray(); $user = $data['user']; if (!isset($tid)) { $tid = 0; } $contents[$data['tid'] != $tid ? (string) $data['tid'] : 0] = array('tid' => $data['tid'], 'content' => $data['content'], 'name' => $user['name'], 'user' => $user['user'], 'url' => $user['url']); } ksort($contents); $contents = array_reverse($contents); }