Date::getDay()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 3
rs 10
c 1
b 0
f 1
ccs 2
cts 2
cp 1
cc 1
eloc 2
nc 1
nop 0
crap 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\AndroidPublisher\InAppProducts;
19
20
use alxmsl\Google\ObjectInitializedInterface;
21
use stdClass;
22
23
/**
24
 * Response date class
25
 * @author alxmsl
26
 */
27
final class Date implements ObjectInitializedInterface {
28
    /**
29
     * @var int day of a month, value in [1, 31] range
30
     */
31
    private $day = 0;
32
33
    /**
34
     * @var int month of a year. e.g. 1 = JAN, 2 = FEB etc
35
     */
36
    private $month = 0;
37
38
    /**
39
     * @return int day of a month, value in [1, 31] range
40
     */
41 2
    public function getDay() {
42 2
        return $this->day;
43
    }
44
45
    /**
46
     * @return int month of a year. e.g. 1 = JAN, 2 = FEB etc
47
     */
48 2
    public function getMonth() {
49 2
        return $this->month;
50
    }
51
52
    /**
53
     * @inheritdoc
54
     */
55 1
    public static function initializeByObject(stdClass $Object) {
56 1
        $Instance        = new self();
57 1
        $Instance->day   = (int) $Object->day;
58 1
        $Instance->month = (int) $Object->month;
59 1
        return $Instance;
60
    }
61
}
62