Skip to content
This repository was archived by the owner on Apr 9, 2024. It is now read-only.

Commit 7a9cbaf

Browse files
committed
added new JSON object
1 parent 90d66bc commit 7a9cbaf

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?php
2+
3+
namespace FortniteApi\Components\Objects;
4+
5+
use Exception;
6+
use FortniteApi\Components\Objects\Reflection\Activator;
7+
8+
class CreatorCode
9+
{
10+
/**
11+
* Undocumented variable
12+
*
13+
* @var Activator
14+
*/
15+
private static $_activator;
16+
17+
/**
18+
* Undocumented variable
19+
*
20+
* @var string
21+
*/
22+
public $id;
23+
/**
24+
* Undocumented variable
25+
*
26+
* @var string
27+
*/
28+
public $slug;
29+
30+
/**
31+
* Undocumented variable
32+
*
33+
* @var string
34+
*/
35+
public $displayName;
36+
37+
/**
38+
* Undocumented variable
39+
*
40+
* @var null|string
41+
*/
42+
public $status;
43+
44+
/**
45+
* Undocumented variable
46+
*
47+
* @var bool
48+
*/
49+
public $verified;
50+
51+
public static function createObject($body)
52+
{
53+
return self::getActivator()->createObjectFromBody($body);
54+
}
55+
56+
public static function createObjectArray($body)
57+
{
58+
return self::getActivator()->createArrayFromBody($body);
59+
}
60+
61+
/**
62+
* Undocumented function
63+
*
64+
* @param CreatorCode $obj
65+
* @param array|mixed $body
66+
* @return bool
67+
*/
68+
private static function initializeObject(&$obj, &$body)
69+
{
70+
try {
71+
$obj->id = $body["id"];
72+
$obj->slug = $body["slug"];
73+
$obj->displayName = $body["displayName"];
74+
$obj->status = $body["status"];
75+
$obj->verified = $body["verified"];
76+
77+
return true;
78+
} catch (Exception $ex) {
79+
return false;
80+
}
81+
}
82+
83+
/**
84+
* Undocumented function
85+
*
86+
* @return Activator
87+
*/
88+
private static function getActivator()
89+
{
90+
if (empty(self::$_activator)) {
91+
self::$_activator = new Activator(function () {
92+
return new CreatorCode();
93+
}, function (&$obj, &$body) {
94+
return self::initializeObject($obj, $body);
95+
});
96+
}
97+
98+
return self::$_activator;
99+
}
100+
}

0 commit comments

Comments
 (0)