fetchAllAccessibleRepos()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace DevBoardLib\GithubApiFacade\User;
4
5
use Github\Client;
6
use Github\ResultPager;
7
8
/**
9
 * Class PaginatedKnpLabsUserFacade.
10
 */
11
class PaginatedKnpLabsUserFacade implements UserFacade
12
{
13
    /** @var  Client */
14
    private $client;
15
    /** @var ResultPager */
16
    private $paginator;
17
18
    /**
19
     * PaginatedKnpLabsUserFacade constructor.
20
     *
21
     * @param Client $client
22
     */
23
    public function __construct(Client $client)
24
    {
25
        $this->client    = $client;
26
        $this->paginator = new ResultPager($this->client);
27
    }
28
29
    /**
30
     * @return array|mixed
31
     */
32
    public function fetchAllAccessibleRepos()
33
    {
34
        return $this->paginator->fetchAll($this->getMeApi(), 'repositories', ['type' => 'all']);
35
    }
36
37
    /**
38
     * @return \Github\Api\ApiInterface
39
     */
40
    private function getMeApi()
41
    {
42
        return $this->client->api('me');
43
    }
44
}
45