Files
scummvm-web/include/Models/GameDemosModel.php
T
Thunderforge 2f2a432581 DATA: Converting Game Demos page to YAML
Since it appears that #110 will require compatibility data to be changed from XML to YAML, I wanted to practice and change a simpler page from XML to YAML. If merged, I'm willing to convert other pages as well (e.g. Links, Press Articles, Screenshots, FAQs) as well
2020-04-02 23:04:54 +02:00

32 lines
853 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';
$a = \yaml_parse_file($fname);
$entries = array();
$entries = array();
foreach ($a['game_demos']['group'] as $key => $value) {
$demos = array();
foreach ($value['demos'] as $data) {
$demos[] = new GameDemo($data);
}
$entries[] = array(
'name' => $value['name'],
'href' => $value['href'],
'demos' => $demos,
);
}
return $entries;
}
}