mirror of
https://github.com/scummvm/scummvm-web.git
synced 2026-06-20 05:45:49 +00:00
Fixes the following Codacy issues: * Avoid variables with short names like `$a`. Configured minimum length is 3. * Avoid unused local variables such as '$key'.
43 lines
1.3 KiB
PHP
43 lines
1.3 KiB
PHP
<?php
|
|
namespace ScummVM\Models;
|
|
|
|
use ScummVM\Objects\Subproject;
|
|
use ScummVM\Objects\File;
|
|
use ScummVM\Objects\BasicObject;
|
|
use ScummVM\XMLParser;
|
|
|
|
/**
|
|
* The SubprojectsModel will generate Project objects.
|
|
*/
|
|
abstract class SubprojectsModel extends BasicModel
|
|
{
|
|
/* Get all the groups and the respectively demos. */
|
|
public static function getAllSubprojects()
|
|
{
|
|
$fname = DIR_DATA . '/subprojects.xml';
|
|
$parser = new XMLParser();
|
|
$parsedData = $parser->parseByFilename($fname);
|
|
$entries = array();
|
|
BasicObject::toArray($parsedData['subprojects']['project']);
|
|
foreach ($parsedData['subprojects']['project'] as $key => $value) {
|
|
$downloads = array();
|
|
foreach ($value['entries'] as $type => $data) {
|
|
if ($type == 'file') {
|
|
BasicObject::toArray($data);
|
|
foreach ($data as $file) {
|
|
$downloads[] = new File($file);
|
|
}
|
|
}
|
|
}
|
|
$entries[] = new Subproject(
|
|
array(
|
|
'name' => $value['name'],
|
|
'info' => $value['info'],
|
|
'downloads' => $downloads,
|
|
)
|
|
);
|
|
}
|
|
return $entries;
|
|
}
|
|
}
|