1 | <?php |
||
12 | class PlaceholderUtils |
||
13 | { |
||
14 | private static $variantTags; |
||
15 | |||
16 | private static $configKeys; |
||
17 | |||
18 | public static function setVariantTags($variantTags) |
||
19 | { |
||
20 | self::$variantTags = $variantTags; |
||
21 | } |
||
22 | |||
23 | public static function setConfigKeys($configKeys) |
||
27 | |||
28 | public static function getSectionKey($tag){ |
||
37 | |||
38 | public static function getConfigTag($tags){ |
||
39 | $configTags = self::filterConfigTags($tags,false); |
||
40 | if (empty($configTags)) { |
||
41 | return false; |
||
42 | } |
||
43 | if (count($configTags) > 1) { |
||
44 | throw new RedundantConfigTagException($configTags); |
||
45 | } |
||
46 | return $configTags[0]; |
||
47 | } |
||
48 | |||
49 | |||
50 | public static function getConfigKey($tag){ |
||
53 | |||
54 | |||
55 | public static function filterVariantTags($tags, $exclude) |
||
56 | { |
||
57 | return array_filter($tags, function ($tag) use ($exclude) { |
||
58 | return (in_array($tag, self::$variantTags) xor $exclude); |
||
59 | }); |
||
60 | } |
||
61 | |||
62 | public static function getVariant($tags){ |
||
73 | |||
74 | |||
75 | public static function filterConfigTags($tags, $exclude) |
||
81 | } |
||
82 |