code: public function determineVersions(array $versions)
      {
          $activeVersion = null;
          $nextVersion = null;
  
          if (!empty($versions)) {
              foreach ($versions as $version) {
                  if ($version->active) {
                      $activeVersion = $version->number;
                  }
              }
  
              $nextVersion = (int) end($versions)->number + 1;
          }
  
          return [
              'active_version'    => $activeVersion,
              'next_version'      => $nextVersion
          ];
      }
docs: Determine currently service active version and the next version in which the active version will be cloned
  
  @param array $versions
  @return array