Skip to content
Snippets Groups Projects
Conversion.php 453 B
<?php

namespace SGalinski\TypoScriptReferenceFrontend\Utilities;

class Conversion {
	/**
	 * The function converts array of attributes to associative array with form: [id => name]
	 *
	 * @param array $attributes
	 * @return array
	 */
	public static function toAssociativeIdNamesArray(array $attributes) {
		$idsAndNames = [];
		foreach ($attributes as $attribute) {
			$idsAndNames[$attribute->id] = $attribute->name;
		}
		return $idsAndNames;
	}
}