/**
  * Using EED_Core_Rest_Api::version_compatibilities(), determines what version of
  * EE the API can serve requests for. Eg, if we are on 4.15 of core, and
  * we can serve requests from 4.12 or later, this will return array( '4.12', '4.13', '4.14', '4.15' ).
  * We also indicate whether or not this version should be put in the index or not
  * @return array keys are API version numbers (just major and minor numbers), and values
  * are whether or not they should be hidden
  */
 public static function versions_served()
 {
     $version_compatibilities = EED_Core_Rest_Api::version_compatibilities();
     $versions_served = array();
     $lowest_compatible_version = $version_compatibilities[EED_Core_Rest_Api::core_version()];
     //for each version of core we have ever served:
     foreach (array_keys(EED_Core_Rest_Api::version_compatibilities()) as $possibly_served_version) {
         //if it's not above the current core version, and it's compatible with the current version of core
         if ($possibly_served_version < EED_Core_Rest_Api::core_version() && $possibly_served_version >= $lowest_compatible_version) {
             $versions_served[$possibly_served_version] = true;
         } else {
             $versions_served[$possibly_served_version] = false;
         }
     }
     return $versions_served;
 }
 /**
  * Using EED_Core_Rest_Api::version_compatibilities(), determines what version of
  * EE the API can serve requests for. Eg, if we are on 4.15 of core, and
  * we can serve requests from 4.12 or later, this will return array( '4.12', '4.13', '4.14', '4.15' ).
  * We also indicate whether or not this version should be put in the index or not
  * @return array keys are API version numbers (just major and minor numbers), and values
  * are whether or not they should be hidden
  */
 public static function versions_served()
 {
     $versions_served = array();
     $possibly_served_versions = EED_Core_Rest_Api::version_compatibilities();
     $lowest_compatible_version = end($possibly_served_versions);
     reset($possibly_served_versions);
     $versions_served_historically = array_keys($possibly_served_versions);
     $latest_version = end($versions_served_historically);
     reset($versions_served_historically);
     //for each version of core we have ever served:
     foreach ($versions_served_historically as $key_versioned_endpoint) {
         //if it's not above the current core version, and it's compatible with the current version of core
         if ($key_versioned_endpoint == $latest_version) {
             //don't hide the latest version in the index
             $versions_served[$key_versioned_endpoint] = false;
         } else {
             if ($key_versioned_endpoint < EED_Core_Rest_Api::core_version() && $key_versioned_endpoint >= $lowest_compatible_version) {
                 //include, but hide, previous versions which are still supported
                 $versions_served[$key_versioned_endpoint] = true;
             } elseif (apply_filters('FHEE__EED_Core_Rest_Api__versions_served__include_incompatible_versions', false, $possibly_served_versions)) {
                 //if a version is no longer supported, don't include it in index or list of versions served
                 $versions_served[$key_versioned_endpoint] = true;
             }
         }
     }
     return $versions_served;
 }