[Scummvm-git-logs] scummvm-web master -> 7c2680462a99cf22cf99f873e83d4d4858f71e6e

Thunderforge noreply at scummvm.org
Wed Dec 21 02:07:31 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm-web' repo located at https://github.com/scummvm/scummvm-web .

Summary:
7c2680462a WEB: Replace dynamic variables with instance variables


Commit: 7c2680462a99cf22cf99f873e83d4d4858f71e6e
    https://github.com/scummvm/scummvm-web/commit/7c2680462a99cf22cf99f873e83d4d4858f71e6e
Author: Thunderforge (wjherrmann at gmail.com)
Date: 2022-12-20T20:07:25-06:00

Commit Message:
WEB: Replace dynamic variables with instance variables

This feature is deprecated in PHP 8.2.

Changed paths:
    include/Objects/DownloadsSection.php
    include/Objects/File.php


diff --git a/include/Objects/DownloadsSection.php b/include/Objects/DownloadsSection.php
index 5b28df0b..3e881f1d 100644
--- a/include/Objects/DownloadsSection.php
+++ b/include/Objects/DownloadsSection.php
@@ -32,11 +32,11 @@ class DownloadsSection extends BasicSection
             // If this item is for an old version, sort all items by version, descending, then by autoId
             if ($this->hasOldVersion($item)) {
                 usort($this->items, function ($a, $b) {
-                    // Return 0 if equal, -1 if $a->version is larger, 1 if $b->version is larger
-                    $versionSortResult = -version_compare($a->version, $b->version);
+                    // Return 0 if equal, -1 if $a->getVersion() is larger, 1 if $b->getVersion() is larger
+                    $versionSortResult = -version_compare($a->getVersion(), $b->getVersion());
                     if ($versionSortResult == 0) {
-                        // Return 0 if equal, -1 if $a->autoId is smaller, 1 if $b->autoId is smaller
-                        return $a->autoId <=> $b->autoId;
+                        // Return 0 if equal, -1 if $a->getAutoId() is smaller, 1 if $b->getAutoId() is smaller
+                        return $a->getAutoId() <=> $b->getAutoId();
                     } else {
                         return $versionSortResult;
                     }
diff --git a/include/Objects/File.php b/include/Objects/File.php
index ca0c2be6..8b30fc49 100644
--- a/include/Objects/File.php
+++ b/include/Objects/File.php
@@ -8,11 +8,15 @@ use ScummVM\FileUtils;
  */
 class File extends BasicObject
 {
+    private $autoId;
+    private $category;
     private $category_icon;
     private $url;
     private $extra_info;
     private $notes;
+    private $subcategory;
     private $user_agent;
+    private $version;
 
     public function __construct($data, $baseUrl = null)
     {
@@ -89,4 +93,16 @@ class File extends BasicObject
     {
         return $this->user_agent;
     }
+
+    /* Get the auto-id (the order it is listed in the data source). */
+    public function getAutoId(): ?int
+    {
+        return $this->autoId;
+    }
+
+    /* Get the version. */
+    public function getVersion(): ?string
+    {
+        return $this->version;
+    }
 }




More information about the Scummvm-git-logs mailing list