| @@ -33,8 +33,9 @@ | ||
| 33 | 33 | $this->client = $client; |
| 34 | 34 | $this->operation = $operation; |
| 35 | 35 | $this->args = $args; |
| 36 | 36 | $this->config = $config; |
| 37 | + MetricsBuilder::appendMetricsCaptureMiddleware($this->client->getHandlerList(), MetricsBuilder::PAGINATOR); | |
| 37 | 38 | } |
| 38 | 39 | /** |
| 39 | 40 | * Runs a paginator asynchronously and uses a callback to handle results. |
| 40 | 41 | * |
| @@ -91,18 +92,27 @@ | ||
| 91 | 92 | public function current() |
| 92 | 93 | { |
| 93 | 94 | return $this->valid() ? $this->result : \false; |
| 94 | 95 | } |
| 96 | + /** | |
| 97 | + * @return mixed | |
| 98 | + */ | |
| 95 | 99 | #[\ReturnTypeWillChange] |
| 96 | 100 | public function key() |
| 97 | 101 | { |
| 98 | 102 | return $this->valid() ? $this->requestCount - 1 : null; |
| 99 | 103 | } |
| 104 | + /** | |
| 105 | + * @return void | |
| 106 | + */ | |
| 100 | 107 | #[\ReturnTypeWillChange] |
| 101 | 108 | public function next() |
| 102 | 109 | { |
| 103 | 110 | $this->result = null; |
| 104 | 111 | } |
| 112 | + /** | |
| 113 | + * @return bool | |
| 114 | + */ | |
| 105 | 115 | #[\ReturnTypeWillChange] |
| 106 | 116 | public function valid() |
| 107 | 117 | { |
| 108 | 118 | if ($this->result) { |
| @@ -125,8 +135,11 @@ | ||
| 125 | 135 | return \true; |
| 126 | 136 | } |
| 127 | 137 | return \false; |
| 128 | 138 | } |
| 139 | + /** | |
| 140 | + * @return void | |
| 141 | + */ | |
| 129 | 142 | #[\ReturnTypeWillChange] |
| 130 | 143 | public function rewind() |
| 131 | 144 | { |
| 132 | 145 | $this->requestCount = 0; |
| @@ -132,9 +145,9 @@ | ||
| 132 | 145 | $this->requestCount = 0; |
| 133 | 146 | $this->nextToken = null; |
| 134 | 147 | $this->result = null; |
| 135 | 148 | } |
| 136 | - private function createNextCommand(array $args, array $nextToken = null) | |
| 149 | + private function createNextCommand(array $args, ?array $nextToken = null) | |
| 137 | 150 | { |
| 138 | 151 | return $this->client->getCommand($this->operation, \array_merge($args, $nextToken ?: [])); |
| 139 | 152 | } |
| 140 | 153 | private function determineNextToken(Result $result) |