Add constructor, ditch ArrayObject

This commit is contained in:
Mike Macgirvin 2023-07-17 21:22:53 +10:00
parent c8b4d54d37
commit 56c25b1c8d

View file

@ -47,6 +47,19 @@ class ASObject
public $canSearch;
public $commentPolicy;
public function __construct($array = null)
{
if ($array && is_array($array)) {
foreach ($array as $key => $value) {
if ($key === '@context') {
$key = 'ldcontext';
}
if (property_exists($this,$key)) {
$this->{$key} = $value;
}
}
}
}
/**
* @return mixed
*/