1 | <?php |
||
45 | abstract class AbstractInterceptor implements Interceptor, OrderedAdvice, Serializable |
||
46 | { |
||
47 | /** |
||
48 | * Local cache of advices for faster unserialization on big projects |
||
49 | * |
||
50 | * @var Closure[] |
||
51 | */ |
||
52 | protected static $localAdvicesCache = []; |
||
53 | |||
54 | /** |
||
55 | * Pointcut expression string which was used for this interceptor |
||
56 | */ |
||
57 | protected $pointcutExpression; |
||
58 | |||
59 | /** |
||
60 | * Closure to call |
||
61 | */ |
||
62 | protected $adviceMethod; |
||
63 | |||
64 | /** |
||
65 | * Advice order |
||
66 | */ |
||
67 | private $adviceOrder; |
||
68 | |||
69 | /** |
||
70 | * Default constructor for interceptor |
||
71 | */ |
||
72 | 11 | public function __construct(Closure $adviceMethod, int $adviceOrder = 0, string $pointcutExpression = '') |
|
78 | |||
79 | /** |
||
80 | * Serialize advice method into array |
||
81 | */ |
||
82 | public static function serializeAdvice(Closure $adviceMethod): array |
||
91 | |||
92 | /** |
||
93 | * Unserialize an advice |
||
94 | * |
||
95 | * @param array $adviceData Information about advice |
||
96 | */ |
||
97 | public static function unserializeAdvice(array $adviceData): Closure |
||
112 | |||
113 | /** |
||
114 | * Returns the advice order |
||
115 | */ |
||
116 | public function getAdviceOrder(): int |
||
120 | |||
121 | /** |
||
122 | * Getter for extracting the advice closure from Interceptor |
||
123 | */ |
||
124 | 2 | public function getRawAdvice(): Closure |
|
128 | |||
129 | /** |
||
130 | * Serializes an interceptor into string representation |
||
131 | * |
||
132 | * @return string the string representation of the object or null |
||
133 | */ |
||
134 | 1 | public function serialize() |
|
141 | |||
142 | /** |
||
143 | * Unserialize an interceptor from the string |
||
144 | * |
||
145 | * @param string $serialized The string representation of the object. |
||
146 | * @return void |
||
147 | */ |
||
148 | 1 | public function unserialize($serialized) |
|
156 | } |
||
157 |