1 | <?php |
||
8 | class Client |
||
9 | { |
||
10 | public $login; |
||
11 | public $password; |
||
12 | public $proxy; |
||
13 | public $method = 'GET'; |
||
14 | public $postDataInBody = false; |
||
15 | |||
16 | const TYPE_JSON = 'json'; |
||
17 | const TYPE_XML = 'xml'; |
||
18 | |||
19 | protected $protocol = 'https'; |
||
20 | protected $url = ''; |
||
21 | protected $type = 'json'; |
||
22 | protected $_guzzleOptions = []; |
||
23 | protected $_guzzle; |
||
24 | protected $_errors; |
||
25 | |||
26 | /** |
||
27 | * Client constructor. |
||
28 | * @param array $config |
||
29 | */ |
||
30 | public function __construct(array $config = []) |
||
38 | |||
39 | public function init() |
||
46 | |||
47 | public function getError($asString = true) |
||
58 | |||
59 | public function validate(array $data) |
||
66 | |||
67 | /** |
||
68 | * @param array $data |
||
69 | * @return array |
||
70 | */ |
||
71 | public function filter(array $data) |
||
81 | |||
82 | /** |
||
83 | * @param $param |
||
84 | * @param $value |
||
85 | * @return mixed |
||
86 | */ |
||
87 | public function filterParam($param, $value) |
||
91 | |||
92 | /** |
||
93 | * @param $param |
||
94 | * @param $value |
||
95 | * @return bool |
||
96 | */ |
||
97 | public function validateParam($param, $value) |
||
101 | |||
102 | /** |
||
103 | * @param $url |
||
104 | * @return string |
||
105 | */ |
||
106 | protected function buildUrl($url) |
||
114 | |||
115 | /** |
||
116 | * @param $urlRequest |
||
117 | * @param array $data |
||
118 | * @return string |
||
119 | */ |
||
120 | public function getContent($urlRequest, $data = []) |
||
137 | |||
138 | /** |
||
139 | * @param $data |
||
140 | * @return mixed|null|\SimpleXMLElement |
||
141 | */ |
||
142 | public function unSerialize($data) |
||
151 | |||
152 | public function addError($param, $message) |
||
156 | |||
157 | /** |
||
158 | * @param $data |
||
159 | * @return string|array |
||
160 | * @throws \Exception |
||
161 | */ |
||
162 | protected function prepareData(array $data) |
||
181 | |||
182 | /** |
||
183 | * @throws \Exception |
||
184 | */ |
||
185 | public function guzzleOptions() |
||
208 | } |
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()
method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail()
, this method _has_ side-effects. In the following case, we could not remove the method call: