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 |
InterceptedMethod.php
01 <?php
02
03 declare(strict_types=1);
04
05 namespace ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator;
06
07 use ProxyManager\Generator\MethodGenerator;
08 use ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator\Util\InterceptorGenerator;
09 use Zend\Code\Generator\PropertyGenerator;
10 use Zend\Code\Reflection\MethodReflection;
11
12 /**
13 * Method with additional pre- and post- interceptor logic in the body
14 *
15 * @author Marco Pivetta <ocramius@gmail.com>
16 * @license MIT
17 */
18 class InterceptedMethod extends MethodGenerator
19 {
20 /**
21 * @throws \Zend\Code\Generator\Exception\InvalidArgumentException
22 */
23 public static function generateMethod(
24 MethodReflection $originalMethod,
25 PropertyGenerator $valueHolderProperty,
26 PropertyGenerator $prefixInterceptors,
27 PropertyGenerator $suffixInterceptors
28 ) : self {
29 /* @var $method self */
30 $method = static::fromReflectionWithoutBodyAndDocBlock($originalMethod);
31 $forwardedParams = [];
32
33 foreach ($originalMethod->getParameters() as $parameter) {
34 $forwardedParams[] = ($parameter->isVariadic() ? '...' : '') . '$' . $parameter->getName();
35 }
36
37 $method->setBody(InterceptorGenerator::createInterceptedMethodBody(
38 '$returnValue = $this->' . $valueHolderProperty->getName() . '->'
39 . $originalMethod->getName() . '(' . implode(', ', $forwardedParams) . ');',
40 $method,
41 $valueHolderProperty,
42 $prefixInterceptors,
43 $suffixInterceptors,
44 $originalMethod
45 ));
46
47 return $method;
48 }
49 }
50