private function phpize(\SimpleXMLElement $array, string $key, string $type) { if (!isset($array[$key])) { return; } switch ($type) { case 'string': return (string) $array[$key]; case 'bool': return (bool) XmlUtils::phpize($array[$key]); } }