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 |
YamlExtension.php
01 <?php
02
03 /*
04 * This file is part of the Symfony package.
05 *
06 * (c) Fabien Potencier <fabien@symfony.com>
07 *
08 * For the full copyright and license information, please view the LICENSE
09 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Bridge\Twig\Extension;
13
14 use Symfony\Component\Yaml\Dumper as YamlDumper;
15 use Symfony\Component\Yaml\Yaml;
16 use Twig\Extension\AbstractExtension;
17 use Twig\TwigFilter;
18
19 /**
20 * Provides integration of the Yaml component with Twig.
21 *
22 * @author Fabien Potencier <fabien@symfony.com>
23 */
24 class YamlExtension extends AbstractExtension
25 {
26 /**
27 * {@inheritdoc}
28 */
29 public function getFilters()
30 {
31 return [
32 new TwigFilter('yaml_encode', [$this, 'encode']),
33 new TwigFilter('yaml_dump', [$this, 'dump']),
34 ];
35 }
36
37 public function encode($input, $inline = 0, $dumpObjects = 0)
38 {
39 static $dumper;
40
41 if (null === $dumper) {
42 $dumper = new YamlDumper();
43 }
44
45 if (\defined('Symfony\Component\Yaml\Yaml::DUMP_OBJECT')) {
46 if (\is_bool($dumpObjects)) {
47 @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::DUMP_OBJECT flag instead.', \E_USER_DEPRECATED);
48
49 $flags = $dumpObjects ? Yaml::DUMP_OBJECT : 0;
50 } else {
51 $flags = $dumpObjects;
52 }
53
54 return $dumper->dump($input, $inline, 0, $flags);
55 }
56
57 return $dumper->dump($input, $inline, 0, false, $dumpObjects);
58 }
59
60 public function dump($value, $inline = 0, $dumpObjects = false)
61 {
62 if (\is_resource($value)) {
63 return '%Resource%';
64 }
65
66 if (\is_array($value) || \is_object($value)) {
67 return '%'.\gettype($value).'% '.$this->encode($value, $inline, $dumpObjects);
68 }
69
70 return $this->encode($value, $inline, $dumpObjects);
71 }
72
73 /**
74 * {@inheritdoc}
75 */
76 public function getName()
77 {
78 return 'yaml';
79 }
80 }
81