1 | <?php |
||
19 | class ObjectHelper |
||
20 | { |
||
21 | /** |
||
22 | * Configures an object with the initial property values. |
||
23 | * |
||
24 | * @param BaseObject $object |
||
25 | * @param array $properties |
||
26 | * @return BaseObject |
||
27 | */ |
||
28 | public static function populate(BaseObject $object, $properties = []): BaseObject |
||
39 | |||
40 | /** |
||
41 | * Create a new object |
||
42 | * |
||
43 | * @param $config |
||
44 | * @param string|null $instanceOf |
||
45 | * @throws InvalidConfigException |
||
46 | * @return BaseObject |
||
47 | */ |
||
48 | public static function create($config, string $instanceOf = null): BaseObject |
||
63 | |||
64 | /** |
||
65 | * Checks the config for a valid class |
||
66 | * |
||
67 | * @param $config |
||
68 | * @param string|null $instanceOf |
||
69 | * @param bool $removeClass |
||
70 | * @throws InvalidConfigException |
||
71 | * @return string |
||
72 | */ |
||
73 | public static function checkConfig(&$config, string $instanceOf = null, bool $removeClass = true): string |
||
93 | |||
94 | /** |
||
95 | * Get a class from a config |
||
96 | * |
||
97 | * @param $config |
||
98 | * @param bool $removeClass |
||
99 | * @throws InvalidConfigException |
||
100 | * @return string |
||
101 | */ |
||
102 | public static function getClassFromConfig(&$config, bool $removeClass = false): string |
||
118 | |||
119 | /** |
||
120 | * Find a class from a config |
||
121 | * |
||
122 | * @param $config |
||
123 | * @param bool $removeClass |
||
124 | * @return null|string |
||
125 | */ |
||
126 | public static function findClassFromConfig(&$config, bool $removeClass = false) |
||
158 | } |
||
159 |