Group::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 9
cts 9
cp 1
rs 9.8333
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Syntax\SteamApi\Containers;
4
5
use SimpleXMLElement;
6
use Syntax\SteamApi\Client;
7
use Illuminate\Support\Collection;
8
use Syntax\SteamApi\Containers\Group\Details;
9
use Syntax\SteamApi\Containers\Group\MemberDetails;
10
11
class Group
12
{
13
    public $groupID64;
14
15
    public $groupDetails;
16
17
    public $memberDetails;
18
19
    public $startingMember;
20
21
    public $members;
22
23
    /**
24
     * @param SimpleXMLElement $group
25
     */
26 2
    function __construct($group)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
27
    {
28 2
        $this->groupID64      = (string)$group->groupID64;
29 2
        $this->groupDetails   = new Details($group->groupDetails);
30 2
        $this->memberDetails  = new MemberDetails($group->groupDetails);
31 2
        $this->startingMember = (int)(string)$group->startingMember;
32
33 2
        $this->members = new Collection;
34
35 2
        foreach ($group->members->steamID64 as $member) {
36 2
            $this->members->add((new Client)->convertId((string)$member));
37
        }
38 2
    }
39
}
40