api_request() private method

Calls the API and, if successfull, returns the object delivered by the API.
private api_request ( string $_action, array $_data ) : false | object
$_action string The requested action.
$_data array Parameters for the API action.
return false | object
 protected function api_request($_action, $_data)
 {
     $time_key = $this->slug . '-plugin_updater_api_request_last_checked';
     $api_key = $this->slug . '-plugin_updater_api_request';
     $entity = new WPFront_User_Role_Editor_Entity_Options();
     $time = $entity->get_option($time_key);
     if ($time === NULL || $time < time() - 6 * 3600) {
         $api = NULL;
     } else {
         $api = $entity->get_option($api_key);
     }
     if ($api === NULL) {
         $api = parent::api_request($_action, $_data);
         if ($api) {
             $entity->update_option($api_key, serialize($api));
             $entity->update_option($time_key, time());
         }
     } else {
         $api = unserialize($api);
     }
     return $api;
 }