proxy() public méthode

만약 어떤 클래스에 interception을 적용하고 싶을 때 이 메소드를 사용하면 된다. $targetClassName = 'My\Namespace\PostManager'; $proxyClass = XeInterception::proxy($targetClass, 'Post'); $postManager = new $proxyClass(); 두번째 파라메터를 사용하여 타겟클래스의 alias 이름을 등록할 수 있다. alias 이름을 지정하면, 타겟 클래스에 interception을 등록할 때, alias 이름을 사용할 수 있다. Post alias를 사용 intercept('Post@insert', 'spam_filter', function(){...});
public proxy ( string $targetClass, string | null $alias = null ) : string
$targetClass string 타겟 클래스
$alias string | null 타겟 클래스의 별칭
Résultat string
 /**
  * Factory constructor.
  *
  * @param InterceptionHandler $interception intercption handler
  */
 public function __construct(InterceptionHandler $interception)
 {
     $this->proxy = $interception->proxy(Counter::class, 'Counter');
 }