clean up, format code

This commit is contained in:
Hash Borgir
2023-06-01 23:32:48 -06:00
parent e277ca9a44
commit 80c1395efc
2 changed files with 130 additions and 105 deletions

View File

@@ -43,21 +43,22 @@
*/
/**
*
* D2Files class.
*/
class D2Files {
/**
* @var array
* @var array Holds the list of files.
*/
public $files = [];
/**
* @var
* @var array Holds the character files.
*/
public $charFiles;
/**
*
* D2Files constructor.
*/
public function __construct() {
$filesToIgnore = [
@@ -68,26 +69,30 @@ class D2Files {
"treasureclass.txt",
"treasureclassex.txt"
];
$glob = glob($_SESSION['path'] . '*.txt');
$glob = glob($_SESSION['path'] . '*.txt'); // Get a list of all ".txt" files in the specified path.
foreach ($glob as $g) {
$files[] = basename($g);
$files[] = basename($g); // Add the base name of each file to the $files array.
}
$this->files = array_udiff($files, $filesToIgnore, 'strcasecmp');
return $this->files;
$this->files = array_udiff($files, $filesToIgnore, 'strcasecmp'); // Remove the ignored files from the list, case-insensitive.
return $this->files; // Return the list of files.
}
/**
* @return mixed
* Get the list of character save files.
*
* @return mixed The list of character save files.
*/
public function getSaveFiles() {
$glob = glob($_SESSION['savepath'] . '*.d2s');
$glob = glob($_SESSION['savepath'] . '*.d2s'); // Get a list of all ".d2s" files in the specified save path.
foreach ($glob as $g) {
$this->charFiles[] = basename($g);
$this->charFiles[] = basename($g); // Add the base name of each file to the $charFiles array.
}
return $this->charFiles;
return $this->charFiles; // Return the list of character save files.
}
}