Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
MinifierList.php
01 <?php
02
03 /**
04 * @package s9e\TextFormatter
05 * @copyright Copyright (c) 2010-2022 The s9e authors
06 * @license http://www.opensource.org/licenses/mit-license.php The MIT License
07 */
08 namespace s9e\TextFormatter\Configurator\Collections;
09
10 use InvalidArgumentException;
11 use ReflectionClass;
12 use s9e\TextFormatter\Configurator\JavaScript\Minifier;
13
14 class MinifierList extends NormalizedList
15 {
16 /**
17 * Normalize the value to an object
18 *
19 * @param Minifier|string $minifier
20 * @return Minifier
21 */
22 public function normalizeValue($minifier)
23 {
24 if (is_string($minifier))
25 {
26 $minifier = $this->getMinifierInstance($minifier);
27 }
28 elseif (is_array($minifier) && !empty($minifier[0]))
29 {
30 $minifier = $this->getMinifierInstance($minifier[0], array_slice($minifier, 1));
31 }
32
33 if (!($minifier instanceof Minifier))
34 {
35 throw new InvalidArgumentException('Invalid minifier ' . var_export($minifier, true));
36 }
37
38 return $minifier;
39 }
40
41 /**
42 * Create and return a Minifier instance
43 *
44 * @param string $name Minifier's name
45 * @param array $args Constructor's arguments
46 * @return Minifier
47 */
48 protected function getMinifierInstance($name, array $args = [])
49 {
50 $className = 's9e\\TextFormatter\\Configurator\\JavaScript\\Minifiers\\' . $name;
51 if (!class_exists($className))
52 {
53 throw new InvalidArgumentException('Invalid minifier ' . var_export($name, true));
54 }
55
56 $reflection = new ReflectionClass($className);
57 $minifier = (empty($args)) ? $reflection->newInstance() : $reflection->newInstanceArgs($args);
58
59 return $minifier;
60 }
61 }