← All changes
|
includes/sdk/google/google/gax/src/FixedSizeCollection.php
+9
-9
1.0.1
→
1.4.1
View file →
| @@ -29,9 +29,9 @@ | ||
| 29 | 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 30 | 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 31 | 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 32 | 32 | */ |
| 33 | -namespace Dudlewebs\WPMCS\Google\ApiCore; | |
| 33 | +namespace Dudlewebs\WPMCS\GCP\Google\ApiCore; | |
| 34 | 34 | |
| 35 | 35 | use Generator; |
| 36 | 36 | use InvalidArgumentException; |
| 37 | 37 | use IteratorAggregate; |
| @@ -57,9 +57,9 @@ | ||
| 57 | 57 | throw new InvalidArgumentException("collectionSize must be > 0. collectionSize: {$collectionSize}"); |
| 58 | 58 | } |
| 59 | 59 | if ($collectionSize < $initialPage->getPageElementCount()) { |
| 60 | 60 | $ipc = $initialPage->getPageElementCount(); |
| 61 | - throw new InvalidArgumentException("collectionSize must be greater than or equal to the number of " . "elements in initialPage. collectionSize: {$collectionSize}, " . "initialPage size: {$ipc}"); | |
| 61 | + throw new InvalidArgumentException('collectionSize must be greater than or equal to the number of ' . "elements in initialPage. collectionSize: {$collectionSize}, " . "initialPage size: {$ipc}"); | |
| 62 | 62 | } |
| 63 | 63 | $this->collectionSize = $collectionSize; |
| 64 | 64 | $this->pageList = FixedSizeCollection::createPageArray($initialPage, $collectionSize); |
| 65 | 65 | } |
| @@ -118,9 +118,9 @@ | ||
| 118 | 118 | public function getIterator() |
| 119 | 119 | { |
| 120 | 120 | foreach ($this->pageList as $page) { |
| 121 | 121 | foreach ($page as $element) { |
| 122 | - yield $element; | |
| 122 | + (yield $element); | |
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | /** |
| @@ -132,12 +132,12 @@ | ||
| 132 | 132 | */ |
| 133 | 133 | public function iterateCollections() |
| 134 | 134 | { |
| 135 | 135 | $currentCollection = $this; |
| 136 | - yield $this; | |
| 136 | + (yield $this); | |
| 137 | 137 | while ($currentCollection->hasNextCollection()) { |
| 138 | 138 | $currentCollection = $currentCollection->getNextCollection(); |
| 139 | - yield $currentCollection; | |
| 139 | + (yield $currentCollection); | |
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | private function getLastPage() |
| 143 | 143 | { |
| @@ -142,10 +142,10 @@ | ||
| 142 | 142 | private function getLastPage() |
| 143 | 143 | { |
| 144 | 144 | $pageList = $this->pageList; |
| 145 | 145 | // Get last element in array... |
| 146 | - $lastPage = end($pageList); | |
| 147 | - reset($pageList); | |
| 146 | + $lastPage = \end($pageList); | |
| 147 | + \reset($pageList); | |
| 148 | 148 | return $lastPage; |
| 149 | 149 | } |
| 150 | 150 | /** |
| 151 | 151 | * @param Page $initialPage |
| @@ -161,11 +161,11 @@ | ||
| 161 | 161 | $remainingCount = $collectionSize - $itemCount; |
| 162 | 162 | $currentPage = $currentPage->getNextPage($remainingCount); |
| 163 | 163 | $rxElementCount = $currentPage->getPageElementCount(); |
| 164 | 164 | if ($rxElementCount > $remainingCount) { |
| 165 | - throw new LengthException("API returned a number of elements " . "exceeding the specified page size limit. page size: " . "{$remainingCount}, elements received: {$rxElementCount}"); | |
| 165 | + throw new LengthException('API returned a number of elements ' . 'exceeding the specified page size limit. page size: ' . "{$remainingCount}, elements received: {$rxElementCount}"); | |
| 166 | 166 | } |
| 167 | - array_push($pageList, $currentPage); | |
| 167 | + \array_push($pageList, $currentPage); | |
| 168 | 168 | $itemCount += $rxElementCount; |
| 169 | 169 | } |
| 170 | 170 | return $pageList; |
| 171 | 171 | } |