This commit is contained in:
James Cole
2018-04-21 20:28:30 +02:00
parent 45cd19d1e3
commit 479648e7c1

View File

@@ -98,6 +98,13 @@ class UserCompany extends BunqObject
*/
public function __construct(array $data)
{
if (\count($data) === 0 || (isset($data['id']) && (int)$data['id'] === 0)) {
$this->id = 0;
$this->created = new Carbon;
$this->updated = new Carbon;
return;
}
$this->id = (int)$data['id'];
$this->created = Carbon::createFromFormat('Y-m-d H:i:s.u', $data['created']);
$this->updated = Carbon::createFromFormat('Y-m-d H:i:s.u', $data['updated']);