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 |
EvaluatingGeneratorStrategy.php
01 <?php
02
03 declare(strict_types=1);
04
05 namespace ProxyManager\GeneratorStrategy;
06
07 use Zend\Code\Generator\ClassGenerator;
08
09 /**
10 * Generator strategy that produces the code and evaluates it at runtime
11 *
12 * @author Marco Pivetta <ocramius@gmail.com>
13 * @license MIT
14 */
15 class EvaluatingGeneratorStrategy implements GeneratorStrategyInterface
16 {
17 /**
18 * @var bool flag indicating whether {@see eval} can be used
19 */
20 private $canEval = true;
21
22 /**
23 * Constructor
24 */
25 public function __construct()
26 {
27 // @codeCoverageIgnoreStart
28 $this->canEval = ! ini_get('suhosin.executor.disable_eval');
29 // @codeCoverageIgnoreEnd
30 }
31
32 /**
33 * Evaluates the generated code before returning it
34 *
35 * {@inheritDoc}
36 */
37 public function generate(ClassGenerator $classGenerator) : string
38 {
39 $code = $classGenerator->generate();
40
41 // @codeCoverageIgnoreStart
42 if (! $this->canEval) {
43 $fileName = tempnam(sys_get_temp_dir(), 'EvaluatingGeneratorStrategy.php.tmp.');
44
45 file_put_contents($fileName, "<?php\n" . $code);
46 /* @noinspection PhpIncludeInspection */
47 require $fileName;
48 unlink($fileName);
49
50 return $code;
51 }
52 // @codeCoverageIgnoreEnd
53
54 eval($code);
55
56 return $code;
57 }
58 }
59