1<?php 2 3/** 4* @package s9e\TextFormatter 5* @copyright Copyright (c) 2010-2021 The s9e authors 6* @license http://www.opensource.org/licenses/mit-license.php The MIT License 7*/ 8namespace s9e\TextFormatter\Configurator\Collections; 9 10use s9e\TextFormatter\Configurator\Validators\AttributeName; 11 12/** 13* Hosts a list of attribute names. The config array it returns contains the names, deduplicated and 14* sorted 15*/ 16class AttributeList extends NormalizedList 17{ 18 /** 19 * Normalize the name of an attribute 20 * 21 * @param string $attrName 22 * @return string 23 */ 24 public function normalizeValue($attrName) 25 { 26 return AttributeName::normalize($attrName); 27 } 28 29 /** 30 * {@inheritdoc} 31 */ 32 public function asConfig() 33 { 34 $list = array_unique($this->items); 35 sort($list); 36 37 return $list; 38 } 39}