Completed
Pull Request — develop (#33)
by Michael
02:17
created

ListFilesIterator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 3
c 2
b 1
f 0
lcom 1
cbo 2
dl 0
loc 20
ccs 0
cts 10
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A sendRequest() 0 12 3
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