Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace danog\MadelineProto;
- abstract class CombinedEventHandler
- {
- private $CombinedAPI;
- public function __construct($CombinedAPI)
- {
- $this->CombinedAPI = $CombinedAPI;
- foreach ($CombinedAPI->instances as $path => $instance) {
- $this->referenceInstance($path);
- }
- }
- final public function __sleep()
- {
- $keys = \method_exists($this, '__magic_sleep') ? $this->__magic_sleep() : \get_object_vars($this);
- unset($keys['CombinedAPI']);
- if (isset($this->CombinedAPI) && $this->CombinedAPI instanceof CombinedAPI) {
- foreach ($this->CombinedAPI->instance_paths as $path) {
- unset($keys[$path]);
- }
- } else {
- foreach ($keys as $key => $value) {
- if ($value instanceof API && $key === $value->session) {
- unset($keys[$key]);
- }
- }
- }
- return \array_keys($keys);
- }
- final public function referenceInstance($path)
- {
- $this->{$path} = $this->CombinedAPI->instances[$path];
- }
- final public function removeInstance($path)
- {
- if (isset($this->{$path})) {
- unset($this->{$path});
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement