Completed
Pull Request — master (#74)
by Ernest
01:33
created

Package   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 28
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 1
1
<?php
2
3
namespace Syntax\SteamApi\Containers;
4
5
class Package extends BaseContainer
6
{
7
    public $id;
8
    public $name;
9
    public $page_image;
10
    public $header;
11
    public $small_logo;
12
    public $apps;
13
    public $page_content;
14
    public $price;
15
    public $platforms;
16
    public $release;
17
18
    public function __construct($package, $id)
19
    {
20
        $this->id = (int) $id;
21
        $this->name = $package->name;
22
        $this->apps = $package->apps;
23
        $this->page_content = $this->checkIssetField($package, 'page_content', 'none');
24
        $this->header = $this->checkIssetField($package, 'header_image', 'none');
25
        $this->small_logo = $this->checkIssetField($package, 'small_logo', 'none');
26
        $this->page_image = $this->checkIssetField($package, 'page_image', 'none');
27
        $this->price = $this->formatPriceObject($package, 'price');
0 ignored issues
show
Bug introduced by
The method formatPriceObject() does not seem to exist on object<Syntax\SteamApi\Containers\Package>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
28
        $this->platforms = $package->platforms;
29
        $this->controller = $package->controller;
0 ignored issues
show
Bug introduced by
The property controller does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
30
        $this->release = $package->release_date;
31
    }
32
}
33