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

Refactor stream_functions to C++ style #963

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

NikOsint
Copy link

@NikOsint NikOsint commented Feb 1, 2024

In this PR stream_functions struct is refactored as a base class with virtual functions.

Classes derived from stream_functions:

  • php_stream_functions
  • ssl_stream_functions
  • tcp_stream_functions
  • udp_stream_functions
  • file_stream_functions

Base class functions implementation just aborts KPHP - it is unexpected to call them.
Functions implementations in derived classes either do the same if corresponding protocol does not support particular function, or are valid implementations if the protocol supports it.
An array<string, bool> was added to the stream_functions struct to store supported functions and avoid throwing and handling exceptions.

@NikOsint
Copy link
Author

NikOsint commented Feb 2, 2024

TODO Implement tests

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

Successfully merging this pull request may close these issues.

1 participant