mirror of
https://github.com/scummvm/scummvm-web.git
synced 2026-05-21 05:40:47 +00:00
4d78399ea2
In the new data model, some field operate as keys for other parts of the model. This now performs some validations and will throw an error if fields are missing. For example: a Game must have an Engine, but does not require datafiles
62 lines
1.4 KiB
PHP
62 lines
1.4 KiB
PHP
<?php
|
|
namespace ScummVM\Objects;
|
|
|
|
/**
|
|
* The Game object represents a game known to ScummVM
|
|
*/
|
|
class Game extends DataObject
|
|
{
|
|
private $name;
|
|
private $engine;
|
|
private $company;
|
|
private $moby_id;
|
|
private $datafiles;
|
|
|
|
/* Article object constructor. */
|
|
public function __construct($data, $engines, $companies)
|
|
{
|
|
parent::__construct($data);
|
|
$this->name = $this->assignFromArray('name', $data, true);
|
|
$this->moby_id = $this->assignFromArray('moby_id', $data);
|
|
$this->datafiles = $this->assignFromArray('datafiles', $data);
|
|
$this->company = $this->assignFromArray($data['company_id'], $companies);
|
|
$this->engine = $this->assignFromArray($data['engine_id'], $engines, true);
|
|
}
|
|
|
|
public function __toString()
|
|
{
|
|
return $this->getName();
|
|
}
|
|
|
|
/* Get the game name. */
|
|
public function getName()
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
/* Get the ScummVM engine name */
|
|
public function getEngine()
|
|
{
|
|
return $this->engine;
|
|
}
|
|
|
|
/* Get the company who made the game */
|
|
public function getCompany()
|
|
{
|
|
return $this->company;
|
|
}
|
|
|
|
/* Get the mobygames id. */
|
|
public function getMobyId()
|
|
{
|
|
return $this->moby_id;
|
|
}
|
|
|
|
/* Get the link to the game datafiles. */
|
|
public function getDatafiles()
|
|
{
|
|
return $this->datafiles;
|
|
}
|
|
|
|
}
|