[ Index ] |
PHP Cross Reference of phpBB-3.3.14-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package s9e\TextFormatter 5 * @copyright Copyright (c) 2010-2022 The s9e authors 6 * @license http://www.opensource.org/licenses/mit-license.php The MIT License 7 */ 8 namespace s9e\TextFormatter\Configurator\Collections; 9 10 use RuntimeException; 11 use s9e\TextFormatter\Configurator\Items\Attribute; 12 use s9e\TextFormatter\Configurator\Validators\AttributeName; 13 14 class AttributeCollection extends NormalizedCollection 15 { 16 /** 17 * {@inheritdoc} 18 */ 19 protected $onDuplicateAction = 'replace'; 20 21 /** 22 * {@inheritdoc} 23 */ 24 protected function getAlreadyExistsException($key) 25 { 26 return new RuntimeException("Attribute '" . $key . "' already exists"); 27 } 28 29 /** 30 * {@inheritdoc} 31 */ 32 protected function getNotExistException($key) 33 { 34 return new RuntimeException("Attribute '" . $key . "' does not exist"); 35 } 36 37 /** 38 * Normalize a key as an attribute name 39 * 40 * @param string $key 41 * @return string 42 */ 43 public function normalizeKey($key) 44 { 45 return AttributeName::normalize($key); 46 } 47 48 /** 49 * Normalize a value to an instance of Attribute 50 * 51 * @param array|null|Attribute $value 52 * @return Attribute 53 */ 54 public function normalizeValue($value) 55 { 56 return ($value instanceof Attribute) 57 ? $value 58 : new Attribute($value); 59 } 60 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |