[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * @package s9e\TextFormatter 5 * @copyright Copyright (c) 2010-2019 The s9e Authors 6 * @license http://www.opensource.org/licenses/mit-license.php The MIT License 7 */ 8 namespace s9e\TextFormatter\Configurator\Collections; 9 use InvalidArgumentException; 10 use ReflectionClass; 11 use s9e\TextFormatter\Configurator\JavaScript\Minifier; 12 class MinifierList extends NormalizedList 13 { 14 public function normalizeValue($minifier) 15 { 16 if (\is_string($minifier)) 17 $minifier = $this->getMinifierInstance($minifier); 18 elseif (\is_array($minifier) && !empty($minifier[0])) 19 $minifier = $this->getMinifierInstance($minifier[0], \array_slice($minifier, 1)); 20 if (!($minifier instanceof Minifier)) 21 throw new InvalidArgumentException('Invalid minifier ' . \var_export($minifier, \true)); 22 return $minifier; 23 } 24 protected function getMinifierInstance($name, array $args = []) 25 { 26 $className = 's9e\\TextFormatter\\Configurator\\JavaScript\\Minifiers\\' . $name; 27 if (!\class_exists($className)) 28 throw new InvalidArgumentException('Invalid minifier ' . \var_export($name, \true)); 29 $reflection = new ReflectionClass($className); 30 $minifier = (empty($args)) ? $reflection->newInstance() : $reflection->newInstanceArgs($args); 31 return $minifier; 32 } 33 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |