[ 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 InvalidArgumentException; 11 use s9e\TextFormatter\Configurator\Helpers\RegexpBuilder; 12 use s9e\TextFormatter\Configurator\Items\Regexp; 13 14 class SchemeList extends NormalizedList 15 { 16 /** 17 * Return this scheme list as a regexp 18 * 19 * @return Regexp 20 */ 21 public function asConfig() 22 { 23 return new Regexp('/^' . RegexpBuilder::fromList($this->items) . '$/Di'); 24 } 25 26 /** 27 * Validate and normalize a scheme name to lowercase, or throw an exception if invalid 28 * 29 * @link http://tools.ietf.org/html/rfc3986#section-3.1 30 * 31 * @param string $scheme URL scheme, e.g. "file" or "ed2k" 32 * @return string 33 */ 34 public function normalizeValue($scheme) 35 { 36 if (!preg_match('#^[a-z][a-z0-9+\\-.]*$#Di', $scheme)) 37 { 38 throw new InvalidArgumentException("Invalid scheme name '" . $scheme . "'"); 39 } 40 41 return strtolower($scheme); 42 } 43 }
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 |