Skip to content

Commit 1ef022c

Browse files
authored
Add team info to Account entity (#314)
1 parent 6988545 commit 1ef022c

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

src/Entity/Account.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,31 @@ final class Account extends AbstractEntity
5454
* @var string
5555
*/
5656
public $statusMessage;
57+
58+
/**
59+
* @var Team
60+
*/
61+
public $team;
62+
63+
/**
64+
* @param array $parameters
65+
*
66+
* @return void
67+
*/
68+
public function build(array $parameters): void
69+
{
70+
foreach ($parameters as $property => $value) {
71+
switch ($property) {
72+
case 'team':
73+
if (\is_object($value)) {
74+
$this->team = new Team($value);
75+
}
76+
unset($parameters[$property]);
77+
78+
break;
79+
}
80+
}
81+
82+
parent::build($parameters);
83+
}
5784
}

src/Entity/Team.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* This file is part of the DigitalOcean API library.
7+
*
8+
* (c) Antoine Kirk <[email protected]>
9+
* (c) Graham Campbell <[email protected]>
10+
*
11+
* For the full copyright and license information, please view the LICENSE
12+
* file that was distributed with this source code.
13+
*/
14+
15+
namespace DigitalOceanV2\Entity;
16+
17+
/**
18+
* @author Roy de Jong <[email protected]>
19+
*/
20+
final class Team extends AbstractEntity
21+
{
22+
/**
23+
* @var string
24+
*/
25+
public $uuid;
26+
27+
/**
28+
* @var string
29+
*/
30+
public $name;
31+
}

0 commit comments

Comments
 (0)