1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
<?php
declare(strict_types=1);
namespace ProxyManagerTestAsset;
use ProxyManager\Proxy\AccessInterceptorValueHolderInterface;
/**
* Base test class to catch instantiations of access interceptor value holders
*
* @author Marco Pivetta <ocramius@gmail.com>
* @license MIT
*/
class AccessInterceptorValueHolderMock implements AccessInterceptorValueHolderInterface
{
/**
* @var object
*/
public $instance;
/**
* @var callable[]
*/
public $prefixInterceptors;
/**
* @var callable[]
*/
public $suffixInterceptors;
/**
* @param object $instance
* @param callable[] $prefixInterceptors
* @param callable[] $suffixInterceptors
*/
public static function staticProxyConstructor($instance, $prefixInterceptors, $suffixInterceptors) : self
{
$selfInstance = new static(); // note: static because on-the-fly generated classes in tests extend this one.
$selfInstance->instance = $instance;
$selfInstance->prefixInterceptors = $prefixInterceptors;
$selfInstance->suffixInterceptors = $suffixInterceptors;
return $selfInstance;
}
public function setMethodPrefixInterceptor(string $methodName, ?\Closure $prefixInterceptor = null) : void
{
// no-op (on purpose)
}
public function setMethodSuffixInterceptor(string $methodName, ?\Closure $suffixInterceptor = null) : void
{
// no-op (on purpose)
}
public function getWrappedValueHolderValue() : ?object
{
return $this->instance;
}
}
|