[ Index ] |
PHP Cross Reference of phpBB-3.3.14-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 3 declare(strict_types=1); 4 5 namespace ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator; 6 7 use ProxyManager\Generator\MethodGenerator; 8 use ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\Util\InterceptorGenerator; 9 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 $prefixInterceptors, 26 PropertyGenerator $suffixInterceptors 27 ) : self { 28 /* @var $method self */ 29 $method = static::fromReflectionWithoutBodyAndDocBlock($originalMethod); 30 $forwardedParams = []; 31 32 foreach ($originalMethod->getParameters() as $parameter) { 33 $forwardedParams[] = ($parameter->isVariadic() ? '...' : '') . '$' . $parameter->getName(); 34 } 35 36 $method->setBody(InterceptorGenerator::createInterceptedMethodBody( 37 '$returnValue = parent::' 38 . $originalMethod->getName() . '(' . implode(', ', $forwardedParams) . ');', 39 $method, 40 $prefixInterceptors, 41 $suffixInterceptors, 42 $originalMethod 43 )); 44 45 return $method; 46 } 47 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |