|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Syntax\SteamApi\Containers; |
|
4
|
|
|
|
|
5
|
|
|
use NukaCode\Database\Collection; |
|
6
|
|
|
|
|
7
|
|
|
class App extends BaseContainer |
|
8
|
|
|
{ |
|
9
|
|
|
public $id; |
|
10
|
|
|
|
|
11
|
|
|
public $type; |
|
12
|
|
|
|
|
13
|
|
|
public $name; |
|
14
|
|
|
|
|
15
|
|
|
public $controllerSupport; |
|
16
|
|
|
|
|
17
|
|
|
public $description; |
|
18
|
|
|
|
|
19
|
|
|
public $about; |
|
20
|
|
|
|
|
21
|
|
|
public $fullgame; |
|
22
|
|
|
|
|
23
|
|
|
public $header; |
|
24
|
|
|
|
|
25
|
|
|
public $website; |
|
26
|
|
|
|
|
27
|
|
|
public $pcRequirements; |
|
28
|
|
|
|
|
29
|
|
|
public $legal; |
|
30
|
|
|
|
|
31
|
|
|
public $developers; |
|
32
|
|
|
|
|
33
|
|
|
public $publishers; |
|
34
|
|
|
|
|
35
|
|
|
public $price; |
|
36
|
|
|
|
|
37
|
|
|
public $platforms; |
|
38
|
|
|
|
|
39
|
|
|
public $metacritic; |
|
40
|
|
|
|
|
41
|
|
|
public $categories; |
|
42
|
|
|
|
|
43
|
2 |
|
public $genres; |
|
44
|
|
|
|
|
45
|
2 |
|
public $release; |
|
46
|
2 |
|
|
|
47
|
2 |
|
public function __construct($app) |
|
48
|
2 |
|
{ |
|
49
|
2 |
|
$this->id = $app->steam_appid; |
|
50
|
2 |
|
$this->type = $app->type; |
|
51
|
2 |
|
$this->name = $app->name; |
|
52
|
2 |
|
$this->controllerSupport = $this->checkIssetField($app, 'controller_support', 'None'); |
|
53
|
2 |
|
$this->description = $app->detailed_description; |
|
54
|
2 |
|
$this->about = $app->about_the_game; |
|
55
|
2 |
|
$this->fullgame = $this->checkIssetField($app, 'fullgame', $this->getFakeFullgameObject()); |
|
56
|
2 |
|
$this->header = $app->header_image; |
|
57
|
2 |
|
$this->website = $this->checkIsNullField($app, 'website', 'None'); |
|
58
|
2 |
|
$this->pcRequirements = $app->pc_requirements; |
|
59
|
2 |
|
$this->legal = $this->checkIssetField($app, 'legal_notice', 'None'); |
|
60
|
2 |
|
$this->developers = $this->checkIssetCollection($app, 'developers'); |
|
61
|
2 |
|
$this->publishers = new Collection($app->publishers); |
|
62
|
2 |
|
$this->price = $this->checkIssetField($app, 'price_overview', $this->getFakePriceObject()); |
|
63
|
|
|
$this->platforms = $app->platforms; |
|
64
|
2 |
|
$this->metacritic = $this->checkIssetField($app, 'metacritic', $this->getFakeMetacriticObject()); |
|
65
|
|
|
$this->categories = $this->checkIssetCollection($app, 'categories'); |
|
66
|
2 |
|
$this->genres = $this->checkIssetCollection($app, 'genres'); |
|
67
|
2 |
|
$this->release = $app->release_date; |
|
68
|
2 |
|
} |
|
69
|
|
|
|
|
70
|
2 |
|
protected function getFakeMetacriticObject() |
|
71
|
|
|
{ |
|
72
|
|
|
$object = new \stdClass(); |
|
73
|
2 |
|
$object->url = null; |
|
74
|
|
|
$object->score = 'No Score'; |
|
75
|
2 |
|
|
|
76
|
2 |
|
return $object; |
|
77
|
|
|
} |
|
78
|
2 |
|
|
|
79
|
|
|
protected function getFakePriceObject() |
|
80
|
|
|
{ |
|
81
|
1 |
|
$object = new \stdClass(); |
|
82
|
|
|
$object->final = 'No price found'; |
|
83
|
|
|
|
|
84
|
|
|
return $object; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
protected function getFakeFullgameObject() |
|
88
|
|
|
{ |
|
89
|
|
|
$object = new \stdClass(); |
|
90
|
|
|
$object->appid = null; |
|
91
|
|
|
$object->name = 'No parent game found'; |
|
92
|
|
|
} |
|
93
|
|
|
} |
|
94
|
|
|
|