|
1
|
|
|
<?php namespace OutlookRestClient\Facade\Responses; |
|
2
|
|
|
/** |
|
3
|
|
|
* Copyright 2017 OpenStack Foundation |
|
4
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
5
|
|
|
* you may not use this file except in compliance with the License. |
|
6
|
|
|
* You may obtain a copy of the License at |
|
7
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
|
8
|
|
|
* Unless required by applicable law or agreed to in writing, software |
|
9
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
|
10
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
11
|
|
|
* See the License for the specific language governing permissions and |
|
12
|
|
|
* limitations under the License. |
|
13
|
|
|
**/ |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Class AbstractResponse |
|
17
|
|
|
* @package OutlookRestClient\Facade\Responses |
|
18
|
|
|
*/ |
|
19
|
|
|
abstract class AbstractResponse |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* @var array |
|
23
|
|
|
*/ |
|
24
|
|
|
protected $content = []; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* AbstractResponse constructor. |
|
28
|
|
|
* @param string $body |
|
29
|
|
|
*/ |
|
30
|
|
|
public function __construct($body) |
|
31
|
|
|
{ |
|
32
|
|
|
$this->content = json_decode($body, true); |
|
|
|
|
|
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @param string $prop_name |
|
37
|
|
|
* @return mixed|null |
|
38
|
|
|
*/ |
|
39
|
|
|
protected function getProperty($prop_name){ |
|
40
|
|
|
return isset($this->content[$prop_name])? $this->content[$prop_name] : null; |
|
41
|
|
|
} |
|
42
|
|
|
/** |
|
43
|
|
|
* @return string |
|
44
|
|
|
*/ |
|
45
|
|
|
public function getId(){ |
|
46
|
|
|
return $this->getProperty(Properties::Id); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @return string |
|
51
|
|
|
*/ |
|
52
|
|
|
public function getChangeKey(){ |
|
53
|
|
|
return $this->getProperty(Properties::ChangeKey); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @return string |
|
58
|
|
|
*/ |
|
59
|
|
|
public function getETag(){ |
|
60
|
|
|
return $this->getProperty(Properties::ETag); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @return string |
|
65
|
|
|
*/ |
|
66
|
|
|
public function getDataId(){ |
|
67
|
|
|
return $this->getProperty(Properties::DataId); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @return string |
|
72
|
|
|
*/ |
|
73
|
|
|
public function getContext(){ |
|
74
|
|
|
return $this->getProperty(Properties::Context); |
|
75
|
|
|
} |
|
76
|
|
|
} |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..