Completed
Branch dev (9c0c80)
by Jakob
14:36
created

Result::append()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php declare(strict_types=1);
2
3
namespace JSKOS;
4
5
/**
6
 * Result set in response to query a JSKOS Service.
7
 */
8
class Result extends Set
9
{
10
    protected $totalCount=0;
11
12
    /**
13
     * Ignores the argument to ensure that a Result is always closed.
14
     */
15
    public function setClosed(bool $closed = true)
16
    {
17
        $this->closed = true;
18
    }
19
20
    /**
21
     * Get the total number of members including other pages.
22
     */
23
    public function getTotalCount(): int
24
    {
25
        return $this->totalCount;
26
    }
27
28
    /**
29
     * Append a Resource and possibly increase totalCount.
30
     */
31
    public function append($resource)
32
    {
33
        parent::append($resource);
34
        $this->totalCount = max($this->totalCount, count($this));
35
    }
36
}
37