Skip to content

Commit b909d4f

Browse files
committed
fix: don't need inner loop anymore as response is always 3 tokens
1 parent 26dbea8 commit b909d4f

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/Folder.php

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -167,21 +167,17 @@ public function quota(): array
167167
foreach ($responses as $response) {
168168
$tokens = $response->tokenAt(3)->tokens();
169169

170-
// Tokens are expected to alternate between keys and values.
171-
for ($i = 0; $i < count($tokens); $i += 3) {
172-
$type = $tokens[$i]->value;
173-
174-
$usage = (int) $tokens[$i + 1]->value;
175-
$limit = (int) $tokens[$i + 2]->value;
176-
177-
if ($type === 'STORAGE') {
178-
$values['usage'] = $usage;
179-
$values['limit'] = $limit;
180-
}
170+
$type = $tokens[0]->value;
171+
$usage = (int) $tokens[1]->value;
172+
$limit = (int) $tokens[2]->value;
181173

182-
$values[$type]['usage'] = $usage;
183-
$values[$type]['limit'] = $limit;
174+
if ($type === 'STORAGE') {
175+
$values['usage'] = $usage;
176+
$values['limit'] = $limit;
184177
}
178+
179+
$values[$type]['usage'] = $usage;
180+
$values[$type]['limit'] = $limit;
185181
}
186182

187183
return $values;

0 commit comments

Comments
 (0)