PageList::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
/**
4
 * This file is part of the Telegraph package.
5
 *
6
 * (c) Arthur Edamov <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 */
12
13
declare(strict_types=1);
14
15
namespace Telegraph;
16
17
/**
18
 * Class PageList
19
 *
20
 * This object represents a list of Telegraph articles belonging to an account.
21
 * Most recently created articles first.
22
 *
23
 * @package Telegraph
24
 */
25
class PageList
26
{
27
    /**
28
     * Total number of pages belonging to the target Telegraph account.
29
     *
30
     * @var int
31
     */
32
    private $totalCount;
33
34
    /**
35
     * Requested pages of the target Telegraph account.
36
     *
37
     * @var Page[]
38
     */
39
    private $pages;
40
41
    public function __construct(array $data)
42
    {
43
        $this->totalCount = $data['total_count'];
44
45
        foreach ($data['pages'] as $page) {
46
            $this->pages[] = new Page($page);
47
        }
48
    }
49
50
}
51