Files
scummvm-web/include/Models/GameDemosModel.php
T
Thunderforge 375325ca94 * DATA: Changing YAML to Flathub style guide
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.
2020-04-04 17:36:23 -05:00

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;
}
}