1 | <?php |
||
42 | class Easemob extends Container |
||
43 | { |
||
44 | const BASE_URL = 'https://a1.easemob.com'; |
||
45 | |||
46 | /** |
||
47 | * Core service providers. |
||
48 | * |
||
49 | * @var array |
||
50 | */ |
||
51 | protected $coreProviders = [ |
||
52 | UserProvider::class, |
||
53 | ChatProvider::class, |
||
54 | ChatRoomProvider::class, |
||
55 | FileProvider::class, |
||
56 | GroupProvider::class, |
||
57 | MessageProvider::class, |
||
58 | ]; |
||
59 | |||
60 | /** |
||
61 | * @var string |
||
62 | */ |
||
63 | protected $api; |
||
64 | |||
65 | 12 | public function __construct(array $config) |
|
82 | |||
83 | /** |
||
84 | * Get all providers. |
||
85 | * |
||
86 | * @return array |
||
87 | */ |
||
88 | public function getProviders() |
||
92 | |||
93 | /** |
||
94 | * @param ServiceProviderInterface $provider |
||
95 | * |
||
96 | * @return $this |
||
97 | */ |
||
98 | 3 | public function setProvider(ServiceProviderInterface $provider) |
|
104 | |||
105 | /** |
||
106 | * @param array $providers |
||
107 | */ |
||
108 | public function setProviders(array $providers) |
||
116 | |||
117 | /** |
||
118 | * Register providers. |
||
119 | */ |
||
120 | 12 | protected function registerProviders() |
|
126 | |||
127 | /** |
||
128 | * Register core providers. |
||
129 | */ |
||
130 | 12 | protected function registerCoreProviders() |
|
149 | |||
150 | /** |
||
151 | * Init logger. |
||
152 | */ |
||
153 | 12 | private function initializeLogger() |
|
168 | |||
169 | /** |
||
170 | * @param string $name |
||
171 | * |
||
172 | * @return mixed |
||
173 | */ |
||
174 | 3 | public function __get($name) |
|
178 | |||
179 | /** |
||
180 | * @param string $name |
||
181 | * @param mixed $value |
||
182 | */ |
||
183 | public function __set($name, $value) |
||
187 | |||
188 | /** |
||
189 | * @param string $name |
||
190 | * |
||
191 | * @return bool |
||
192 | */ |
||
193 | public function __isset($name) |
||
197 | |||
198 | /** |
||
199 | * @param string $name |
||
200 | */ |
||
201 | public function __unset($name) |
||
205 | } |
||
206 |
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: