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

improvement ideas for popularity #1

Open
alpham8 opened this issue Dec 27, 2020 · 0 comments
Open

improvement ideas for popularity #1

alpham8 opened this issue Dec 27, 2020 · 0 comments

Comments

@alpham8
Copy link

alpham8 commented Dec 27, 2020

Hi,

thank you for providing us that great gnupg port and I appriciate all work so far on it. To be honest for just calling it a "port", it might be enough.

But in order to help the project to gain more acceptance in the community, in order to pay the respect to your work and in order to not suprise you with a pull request fixing all that stuff in a "huge" one, the following are my recommendations and / or improvement ideas. You might want to spilt it up into separate tasks, if you feel comfortable with:

  • reformat your php code according to the de-facto leading PSR-12 standard
  • logging to php's stderr stream is old school, instead require the PSR LoggerInterface as dependency and inject it using dependency injection: This way, it basically can be logged through php stderr, but it scales a lot more to which stream(s) the message should be logged onto. I'd recommend to use it as an default constructor parameter and via a setter method in the class itself.
  • require in the composer.json also the needed php (ext-json with version *) extension dependencies and the operating system dependencies as well. Since it that library you don't really distinguish between cli and web server usage, it's pretty common to provide all these libs as dependencies in the compser's require section. This way, you can be sure that there is e. g. json present in the current php runtime, so no need for class-level-checks.
  • try to simplify your code complexity by avoiding much deep nested if / while etc. blocks for better maintainability. static code analyzers like phpstan/phpstan might be a good tool for detecting such code smells and providing a helpful complexity score in order to figure out what should be fixed and what shouldn't
  • maybe enforce the coding style from contributers by using an .editorconfig file, which most code editors and IDEs nowadays provide support for: https://editorconfig.org/

This above list might not be complete, but should lead the project in the right direction. And I hope you will find these tips helpful. I'd like to read your feedback to my thoughts, Please note that these tips were brought to my head by a quick code review.

cheers,

alpham8

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

1 participant