Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
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
17 /**
18 * Provides integration of the Yaml component with Twig.
19 *
20 * @author Fabien Potencier <fabien@symfony.com>
21 */
22 class YamlExtension extends \Twig_Extension
23 {
24 /**
25 * {@inheritdoc}
26 */
27 public function getFilters()
28 {
29 return array(
30 new \Twig_SimpleFilter('yaml_encode', array($this, 'encode')),
31 new \Twig_SimpleFilter('yaml_dump', array($this, 'dump')),
32 );
33 }
34
35 public function encode($input, $inline = 0, $dumpObjects = false)
36 {
37 static $dumper;
38
39 if (null === $dumper) {
40 $dumper = new YamlDumper();
41 }
42
43 if (defined('Symfony\Component\Yaml\Yaml::DUMP_OBJECT')) {
44 return $dumper->dump($input, $inline, 0, is_bool($dumpObjects) ? Yaml::DUMP_OBJECT : 0);
45 }
46
47 return $dumper->dump($input, $inline, 0, false, $dumpObjects);
48 }
49
50 public function dump($value, $inline = 0, $dumpObjects = false)
51 {
52 if (is_resource($value)) {
53 return '%Resource%';
54 }
55
56 if (is_array($value) || is_object($value)) {
57 return '%'.gettype($value).'% '.$this->encode($value, $inline, $dumpObjects);
58 }
59
60 return $this->encode($value, $inline, $dumpObjects);
61 }
62
63 /**
64 * {@inheritdoc}
65 */
66 public function getName()
67 {
68 return 'yaml';
69 }
70 }
71