SyncMessage   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 34
rs 10
c 1
b 0
f 0
ccs 9
cts 9
cp 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setCollapseKey() 0 4 1
A getCollapseKey() 0 3 1
A export() 0 5 1
1
<?php
2
/*
3
 * Copyright 2015 Alexey Maslov <[email protected]>
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 * http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
namespace alxmsl\Google\GCM\Message;
19
20
/**
21
 * Class for send-to-sync GCM message
22
 * @author alxmsl
23
 * @date 5/27/13
24
 */ 
25
class SyncMessage extends PayloadMessage {
26
    /**
27
     * @var string messages collapse key
28
     */
29
    private $collapseKey = '';
30
31
    /**
32
     * Collapse key setter
33
     * @param string $collapseKey collapse key
34
     * @return SyncMessage self
35
     */
36 1
    public function setCollapseKey($collapseKey) {
37 1
        $this->collapseKey = (string) $collapseKey;
38 1
        return $this;
39
    }
40
41
    /**
42
     * Collapse key getter
43
     * @return string collapse key
44
     */
45 2
    public function getCollapseKey() {
46 2
        return $this->collapseKey;
47
    }
48
49
    /**
50
     * Method for export instance data
51
     * @return array exported data
52
     */
53 2
    public function export() {
54 2
        return parent::export() + [
55 2
            'collapse_key' => $this->getCollapseKey(),
56 2
        ];
57
    }
58
}
59