<commit_before><?php
namespace tomlib\object;

function try_get_property($object, $name, $default = null) {
		if(property_exists($object, $name))
				return $object->$name;
		else
				return $default;
}

function to_indexed_array($object, $properties, $reference = false) {
		if($reference) {
				foreach($properties as $property) {
						$result[] =& try_get_property($object, $property);
				}
		} else {
				foreach($properties as $property) {
						$result[] = try_get_property($object, $property);
				}
		}

		return $result;
}
<commit_msg>Add index assignments to to_indexed_array<commit_after><?php
namespace tomlib\object;

function try_get_property($object, $name, $default = null) {
		if(property_exists($object, $name))
				return $object->$name;
		else
				return $default;
}

function to_indexed_array($object, $properties, $reference = false) {
		if($reference) {
				foreach($properties as $property) {
						$result[$property] =& try_get_property($object, $property);
				}
		} else {
				foreach($properties as $property) {
						$result[$property] = try_get_property($object, $property);
				}
		}

		return $result;
}

{'fraction_non_alphanumeric': 0.14189189189189189, 'fraction_numerical': 0.0, 'mean_word_length': 3.5402298850574714, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4504530', 'n_tokens_mistral': 446, 'n_tokens_neox': 372, 'n_words': 76}