Bulk::getMaxOperations()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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 Bulk extends AbstractSPCItem
15
{
16
    /** @var int */
17
    protected $maxOperations;
18
19
    /** @var int */
20
    protected $maxPayloadSize;
21
22
    /**
23
     * @param bool $supported
24
     * @param int  $maxOperations
25
     * @param int  $maxPayloadSize
26
     */
27
    public function __construct($supported, $maxOperations, $maxPayloadSize)
28
    {
29
        parent::__construct($supported);
30
31
        $this->maxOperations = $maxOperations;
32
        $this->maxPayloadSize = $maxPayloadSize;
33
    }
34
35
    /**
36
     * @return int
37
     */
38
    public function getMaxOperations()
39
    {
40
        return $this->maxOperations;
41
    }
42
43
    /**
44
     * @return int
45
     */
46
    public function getMaxPayloadSize()
47
    {
48
        return $this->maxPayloadSize;
49
    }
50
51
    public function serializeObject()
52
    {
53
        $result = parent::serializeObject();
54
55
        if ($this->isSupported()) {
56
            $result['maxOperations'] = $this->maxOperations;
57
            $result['maxPayloadSize'] = $this->maxPayloadSize;
58
        }
59
60
        return $result;
61
    }
62
63
    /**
64
     * @param array $data
65
     *
66
     * @return Bulk
67
     */
68
    public static function deserializeObject(array $data)
69
    {
70
        /** @var Bulk $result */
71
        $result = parent::deserializeObject($data);
72
        $result->maxOperations = $data['maxOperations'];
73
        $result->maxPayloadSize = $data['maxPayloadSize'];
74
75
        return $result;
76
    }
77
}
78