public function get_sections()
{
if (false === ($sections = get_transient('apple_news_sections'))) {
$sections = array();
$channel = $this->get_setting('api_channel');
if (!empty($channel)) {
try {
$apple_news_sections = $this->get_api()->get_sections($channel);
$sections = !empty($apple_news_sections->data) ? $apple_news_sections->data : array();
} catch (\Apple_Push_API\Request\Request_Exception $e) {
$sections = array();
}
set_transient('apple_news_sections', $sections, 300);
}
}
return $sections;
}