mirror of
https://github.com/scummvm/scummvm-web.git
synced 2026-06-20 05:45:49 +00:00
With YAML being a very flexible format, it would be good to have some consistency with how it is formatted. Flathub is a pretty commonly used repository and has good YAML guidelines, so I think it's good to reflect them.
31 lines
836 B
PHP
31 lines
836 B
PHP
<?php
|
|
namespace ScummVM\Models;
|
|
|
|
use ScummVM\Objects\GameDemo;
|
|
|
|
/**
|
|
* The GameDemosModel class will generate GameDemo objects.
|
|
*/
|
|
abstract class GameDemosModel extends BasicModel
|
|
{
|
|
/* Get all the groups and their respective demos. */
|
|
public static function getAllGroupsAndDemos()
|
|
{
|
|
$fname = DIR_DATA . '/game_demos.yaml';
|
|
$parsedData = \yaml_parse_file($fname);
|
|
$entries = array();
|
|
foreach (array_values($parsedData['groups']) as $value) {
|
|
$demos = array();
|
|
foreach ($value['demos'] as $data) {
|
|
$demos[] = new GameDemo($data);
|
|
}
|
|
$entries[] = array(
|
|
'name' => $value['name'],
|
|
'href' => $value['href'],
|
|
'demos' => $demos,
|
|
);
|
|
}
|
|
return $entries;
|
|
}
|
|
}
|