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