Completed
Push — develop ( 90d434...5a25e9 )
by Michael
02:38
created

ListFilesIterator::sendRequest()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 12
ccs 0
cts 10
cp 0
rs 9.4285
cc 3
eloc 7
nc 4
nop 0
crap 12
1
<?php
2
3
namespace Crummy\Phlack\Bridge\Guzzle\Model;
4
5
use Guzzle\Service\Resource\ResourceIterator;
6
7
class ListFilesIterator extends ResourceIterator
8
{
9
    /**
10
     * Send a request to retrieve the next page of results. Hook for subclasses to implement.
11
     *
12
     * @return array Returns the newly loaded resources
13
     */
14
    protected function sendRequest()
15
    {
16
        if ($this->nextToken) {
17
            $this->command->set('page', $this->nextToken);
18
        }
19
20
        $result = $this->command->execute();
21
        $currentToken = $result['paging']['page'];
22
        $this->nextToken = $result['paging']['pages'] > $currentToken ? ++$currentToken : false;
0 ignored issues
show
Documentation Bug introduced by
It seems like $result['paging']['pages...++$currentToken : false of type integer or double or false is incompatible with the declared type string of property $nextToken.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
23
24
        return $result['files'];
25
    }
26
}
27