@@ 37-48 (lines=12) @@ | ||
34 | * @throws \Kaylyu\Alipay\Kernel\Exceptions\InvalidArgumentException |
|
35 | * @throws \ReflectionException |
|
36 | */ |
|
37 | public function push($handler, $condition = '*') |
|
38 | { |
|
39 | list($handler, $condition) = $this->resolveHandlerAndCondition($handler, $condition); |
|
40 | ||
41 | if (!isset($this->handlers[$condition])) { |
|
42 | $this->handlers[$condition] = []; |
|
43 | } |
|
44 | ||
45 | array_push($this->handlers[$condition], $handler); |
|
46 | ||
47 | return $this->newClause($handler); |
|
48 | } |
|
49 | ||
50 | /** |
|
51 | * @param \Closure|EventHandlerInterface|string $handler |
|
@@ 59-70 (lines=12) @@ | ||
56 | * @throws \Kaylyu\Alipay\Kernel\Exceptions\InvalidArgumentException |
|
57 | * @throws \ReflectionException |
|
58 | */ |
|
59 | public function unshift($handler, $condition = '*') |
|
60 | { |
|
61 | list($handler, $condition) = $this->resolveHandlerAndCondition($handler, $condition); |
|
62 | ||
63 | if (!isset($this->handlers[$condition])) { |
|
64 | $this->handlers[$condition] = []; |
|
65 | } |
|
66 | ||
67 | array_unshift($this->handlers[$condition], $handler); |
|
68 | ||
69 | return $this->newClause($handler); |
|
70 | } |
|
71 | ||
72 | /** |
|
73 | * @param string $condition |