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 |
FromTokenParser.php
01 <?php
02
03 /*
04 * This file is part of Twig.
05 *
06 * (c) Fabien Potencier
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 Twig\TokenParser;
13
14 use Twig\Node\Expression\AssignNameExpression;
15 use Twig\Node\ImportNode;
16 use Twig\Token;
17
18 /**
19 * Imports macros.
20 *
21 * {% from 'forms.html' import forms %}
22 */
23 final class FromTokenParser extends AbstractTokenParser
24 {
25 public function parse(Token $token)
26 {
27 $macro = $this->parser->getExpressionParser()->parseExpression();
28 $stream = $this->parser->getStream();
29 $stream->expect(/* Token::NAME_TYPE */ 5, 'import');
30
31 $targets = [];
32 do {
33 $name = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue();
34
35 $alias = $name;
36 if ($stream->nextIf('as')) {
37 $alias = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue();
38 }
39
40 $targets[$name] = $alias;
41
42 if (!$stream->nextIf(/* Token::PUNCTUATION_TYPE */ 9, ',')) {
43 break;
44 }
45 } while (true);
46
47 $stream->expect(/* Token::BLOCK_END_TYPE */ 3);
48
49 $var = new AssignNameExpression($this->parser->getVarName(), $token->getLine());
50 $node = new ImportNode($macro, $var, $token->getLine(), $this->getTag(), $this->parser->isMainScope());
51
52 foreach ($targets as $name => $alias) {
53 $this->parser->addImportedSymbol('function', $alias, 'macro_'.$name, $var);
54 }
55
56 return $node;
57 }
58
59 public function getTag()
60 {
61 return 'from';
62 }
63 }
64
65 class_alias('Twig\TokenParser\FromTokenParser', 'Twig_TokenParser_From');
66