App   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 126
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 2
dl 0
loc 126
ccs 51
cts 51
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 32 1
A getFakeMetacriticObject() 0 7 1
A getFakePriceObject() 0 6 1
A getFakeFullgameObject() 0 7 1
A getFakeRecommendationsObject() 0 6 1
A getFakeAchievementsObject() 0 6 1
1
<?php
2
3
namespace Syntax\SteamApi\Containers;
4
5
use Illuminate\Support\Collection;
6
use stdClass;
7
8
class App extends BaseContainer
9
{
10
    public $id;
11
12
    public $type;
13
14
    public $name;
15
16
    public $controllerSupport;
17
18
    public $description;
19
20
    public $about;
21
22
    public $fullgame;
23
24
    public $header;
25
26
    public $website;
27
28
    public $pcRequirements;
29
30
    public $legal;
31
32
    public $developers;
33
34
    public $publishers;
35
36
    public $price;
37
38
    public $platforms;
39
40
    public $metacritic;
41
42
    public $categories;
43
44
    public $genres;
45
46
    public $release;
47
48
    public $requiredAge;
49
50
    public $isFree;
51
52
    public $shortDescription;
53
54
    public $supportedLanguages;
55
56
    public $recommendations;
57
58
    public $achievements;
59
60
    public $dlc;
61
    
62
    public $movies;
63
64 1
    public function __construct($app)
65
    {
66
67 1
        $this->id                 = $app->steam_appid;
68 1
        $this->type               = $app->type;
69 1
        $this->name               = $app->name;
70 1
        $this->controllerSupport  = $this->checkIssetField($app, 'controller_support', 'None');
71 1
        $this->description        = $app->detailed_description;
72 1
        $this->about              = $app->about_the_game;
73 1
        $this->fullgame           = $this->checkIssetField($app, 'fullgame', $this->getFakeFullgameObject());
74 1
        $this->header             = $app->header_image;
75 1
        $this->website            = $this->checkIsNullField($app, 'website', 'None');
76 1
        $this->pcRequirements     = $app->pc_requirements;
77 1
        $this->legal              = $this->checkIssetField($app, 'legal_notice', 'None');
78 1
        $this->developers         = $this->checkIssetCollection($app, 'developers');
79 1
        $this->publishers         = new Collection($app->publishers);
80 1
        $this->price              = $this->checkIssetField($app, 'price_overview', $this->getFakePriceObject());
81 1
        $this->platforms          = $app->platforms;
82 1
        $this->metacritic         = $this->checkIssetField($app, 'metacritic', $this->getFakeMetacriticObject());
83 1
        $this->categories         = $this->checkIssetCollection($app, 'categories');
84 1
        $this->genres             = $this->checkIssetCollection($app, 'genres');
85 1
        $this->release            = $app->release_date;
86 1
        $this->requiredAge        = (int)$app->required_age;
87 1
        $this->isFree             = $app->is_free;
88 1
        $this->shortDescription   = $app->short_description;
89 1
        $this->supportedLanguages = $this->checkIssetField($app, 'supported_languages', 'None');
90 1
        $this->recommendations    = $this->checkIssetField($app, 'recommendations', $this->getFakeRecommendationsObject());
91 1
        $this->achievements       = $this->checkIssetField($app, 'achievements', $this->getFakeAchievementsObject());
92 1
        $this->dlc                = $this->checkIssetCollection($app, 'dlc', new Collection());
93 1
        $this->movies             = $this->checkIssetCollection($app, 'movies', new Collection());
94
95 1
    }
96
97 1
    protected function getFakeMetacriticObject()
98
    {
99 1
        $object        = new stdClass();
100 1
        $object->url   = null;
101 1
        $object->score = 'No Score';
102 1
        return $object;
103
    }
104
105 1
    protected function getFakePriceObject()
106
    {
107 1
        $object        = new stdClass();
108 1
        $object->final = 'No price found';
109 1
        return $object;
110
    }
111
112 1
    protected function getFakeFullgameObject()
113
    {
114 1
        $object        = new stdClass();
115 1
        $object->appid = null;
116 1
        $object->name  = 'No parent game found';
117 1
        return $object;
118
    }
119
120 1
    protected function getFakeRecommendationsObject()
121
    {
122 1
        $object        = new stdClass();
123 1
        $object->total = 0;
124 1
        return $object;
125
    }
126
127 1
    protected function getFakeAchievementsObject()
128
    {
129 1
        $object        = new stdClass();
130 1
        $object->total = 0;
131 1
        return $object;
132
    }
133
}
134