Filter::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
/*
4
 * This file is part of the tmilos/scim-schema package.
5
 *
6
 * (c) Milos Tomic <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Tmilos\ScimSchema\Model\SPC;
13
14
class Filter extends AbstractSPCItem
15
{
16
    /** @var int */
17
    protected $maxResults;
18
19
    /**
20
     * @param bool $supported
21
     * @param int  $maxResults
22
     */
23
    public function __construct($supported, $maxResults)
24
    {
25
        parent::__construct($supported);
26
27
        $this->maxResults = $maxResults;
28
    }
29
30
    /**
31
     * @return int
32
     */
33
    public function getMaxResults()
34
    {
35
        return $this->maxResults;
36
    }
37
38
    public function serializeObject()
39
    {
40
        $result = parent::serializeObject();
41
42
        if ($this->isSupported()) {
43
            $result['maxResults'] = $this->maxResults;
44
        }
45
46
        return $result;
47
    }
48
49
    /**
50
     * @param array $arr
51
     *
52
     * @return Filter
53
     */
54
    public static function deserializeObject(array $arr)
55
    {
56
        /** @var Filter $result */
57
        $result = parent::deserializeObject($arr);
58
        $result->maxResults = $arr['maxResults'];
59
60
        return $result;
61
    }
62
}
63