public static function createFromObject(ArrayAccess $elements) { $array = new static(); foreach ($elements as $key => $value) { $array[$key] = $value; } return $array; }