Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Вопрос о наследовании и Demon #18

Closed
Sirgalas opened this issue Jul 1, 2016 · 4 comments
Closed

Вопрос о наследовании и Demon #18

Sirgalas opened this issue Jul 1, 2016 · 4 comments

Comments

@Sirgalas
Copy link

Sirgalas commented Jul 1, 2016

стал изучать Ваш demon и заметил что он наследуется от класса Generic но самого класса не нашел не нашел так же и следующих свойств

  1. $this->clients
  2. $this->_write
  3. $this->_read
  4. $this->_read

и метода

  • $this->_read();

я так понимаю они должны быть в классе Generic и как сейчас без них работает Demon ?

@morozovsk
Copy link
Owner

Server.php:
if (!empty($this->config['eventDriver']) && $this->config['eventDriver'] == 'libevent') {
class_alias('morozovsk\websocket\GenericLibevent', 'morozovsk\websocket\Generic');
} elseif (!empty($this->config['eventDriver']) && $this->config['eventDriver'] == 'event') {
class_alias('morozovsk\websocket\GenericEvent', 'morozovsk\websocket\Generic');
} else {
class_alias('morozovsk\websocket\GenericSelect', 'morozovsk\websocket\Generic');
}

@Sirgalas
Copy link
Author

Sirgalas commented Jul 2, 2016

Спасибо большое.

@defk
Copy link

defk commented Jul 26, 2017

Доброго дня!
опять таки с классом morozovsk\websocket\Generic.
в yii2 есть рекомендуемое ими автодополнение (так: https://raw.githubusercontent.com/yiisoft/yii2/master/contrib/completion/bash/yii ), но при добавлении Вашего расширения оно ломается, так как не может найти morozovsk\websocket\Generic
с этим можно что-то сделать?

@morozovsk
Copy link
Owner

одно из двух

  1. переписать моё расширение, в частности вот этот код:
        if (!empty($this->config['eventDriver']) && $this->config['eventDriver'] == 'libevent') {
            class_alias('morozovsk\websocket\GenericLibevent', 'morozovsk\websocket\Generic');
        } elseif (!empty($this->config['eventDriver']) && $this->config['eventDriver'] == 'event') {
            class_alias('morozovsk\websocket\GenericEvent', 'morozovsk\websocket\Generic');
        } else {
            class_alias('morozovsk\websocket\GenericSelect', 'morozovsk\websocket\Generic');
        }
  1. переписать расширение для автодополнения, чтобы оно поддерживало конструкцию class_alias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants