| @@ 11-73 (lines=63) @@ | ||
| 8 | use Symfony\Component\HttpFoundation\Request; |
|
| 9 | ||
| 10 | if(Kernel::VERSION_ID >= 40300) { |
|
| 11 | class GenerateKeyEvent extends ContractsEvent |
|
| 12 | { |
|
| 13 | ||
| 14 | /** @var Request */ |
|
| 15 | protected $request; |
|
| 16 | ||
| 17 | /** @var string */ |
|
| 18 | protected $key; |
|
| 19 | ||
| 20 | /** @var mixed */ |
|
| 21 | protected $payload; |
|
| 22 | ||
| 23 | public function __construct(Request $request, $key = '', $payload = null) |
|
| 24 | { |
|
| 25 | $this->request = $request; |
|
| 26 | $this->key = $key; |
|
| 27 | $this->payload = $payload; |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @return string |
|
| 32 | */ |
|
| 33 | public function getKey() |
|
| 34 | { |
|
| 35 | return $this->key; |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * @param string $key |
|
| 40 | */ |
|
| 41 | public function setKey($key) |
|
| 42 | { |
|
| 43 | $this->key = $key; |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * @return Request |
|
| 48 | */ |
|
| 49 | public function getRequest() |
|
| 50 | { |
|
| 51 | return $this->request; |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * @param $part |
|
| 56 | */ |
|
| 57 | public function addToKey($part) |
|
| 58 | { |
|
| 59 | if ($this->key) { |
|
| 60 | $this->key .= '.' . $part; |
|
| 61 | } else { |
|
| 62 | $this->key = $part; |
|
| 63 | } |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * @return mixed |
|
| 68 | */ |
|
| 69 | public function getPayload() |
|
| 70 | { |
|
| 71 | return $this->payload; |
|
| 72 | } |
|
| 73 | } |
|
| 74 | } else { |
|
| 75 | class GenerateKeyEvent extends ComponentEvent |
|
| 76 | { |
|
| @@ 75-137 (lines=63) @@ | ||
| 72 | } |
|
| 73 | } |
|
| 74 | } else { |
|
| 75 | class GenerateKeyEvent extends ComponentEvent |
|
| 76 | { |
|
| 77 | ||
| 78 | /** @var Request */ |
|
| 79 | protected $request; |
|
| 80 | ||
| 81 | /** @var string */ |
|
| 82 | protected $key; |
|
| 83 | ||
| 84 | /** @var mixed */ |
|
| 85 | protected $payload; |
|
| 86 | ||
| 87 | public function __construct(Request $request, $key = '', $payload = null) |
|
| 88 | { |
|
| 89 | $this->request = $request; |
|
| 90 | $this->key = $key; |
|
| 91 | $this->payload = $payload; |
|
| 92 | } |
|
| 93 | ||
| 94 | /** |
|
| 95 | * @return string |
|
| 96 | */ |
|
| 97 | public function getKey() |
|
| 98 | { |
|
| 99 | return $this->key; |
|
| 100 | } |
|
| 101 | ||
| 102 | /** |
|
| 103 | * @param string $key |
|
| 104 | */ |
|
| 105 | public function setKey($key) |
|
| 106 | { |
|
| 107 | $this->key = $key; |
|
| 108 | } |
|
| 109 | ||
| 110 | /** |
|
| 111 | * @return Request |
|
| 112 | */ |
|
| 113 | public function getRequest() |
|
| 114 | { |
|
| 115 | return $this->request; |
|
| 116 | } |
|
| 117 | ||
| 118 | /** |
|
| 119 | * @param $part |
|
| 120 | */ |
|
| 121 | public function addToKey($part) |
|
| 122 | { |
|
| 123 | if ($this->key) { |
|
| 124 | $this->key .= '.' . $part; |
|
| 125 | } else { |
|
| 126 | $this->key = $part; |
|
| 127 | } |
|
| 128 | } |
|
| 129 | ||
| 130 | /** |
|
| 131 | * @return mixed |
|
| 132 | */ |
|
| 133 | public function getPayload() |
|
| 134 | { |
|
| 135 | return $this->payload; |
|
| 136 | } |
|
| 137 | } |
|
| 138 | } |
|
| 139 | ||