GCMServerError::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 6
rs 9.4285
c 1
b 0
f 0
cc 2
eloc 4
nc 2
nop 3
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\Exception;
19
20
/**
21
 * Except when something wrong on the GCM server
22
 * @author alxmsl
23
 * @date 7/19/14
24
 */ 
25
final class GCMServerError extends GCMException {
26
    /**
27
     * @var int retry timeout
28
     */
29
    private $retryAfter = 0;
30
31
    /**
32
     * Retry timeout getter
33
     * @return int retry timeout timestamp
34
     */
35
    public function getRetryAfter() {
36
        return $this->retryAfter;
37
    }
38
39
    /**
40
     * @param null|string $retryAfter retry after header value
41
     * @param string $message exception message
42
     * @param int $code exception error code
43
     */
44
    public function __construct($retryAfter = null, $message = '', $code = 0) {
45
        if (!is_null($retryAfter)) {
46
            $this->retryAfter = strtotime($retryAfter);
47
        }
48
        parent::__construct($message, $code);
49
    }
50
}
51