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

improved isAvailable #51

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

improved isAvailable #51

wants to merge 28 commits into from

Conversation

igorplaton
Copy link

not_found_string as array for multiple options,
added new prefix "negation" for check isAvailable,
added new rule for SK domain into whois servers JSON

@johnny-bit
Copy link

Hi!

At first I believed Your change to be correct and quite nice, however after re-scanning it and changes needed to both whois.servers.json and general logic of processing whois, I came to conclussion that this might not be the best way to handle this 😉

In my opinion you could use grouping operators and negative lookaheads. That way instead of complicating code for parsing, you could write single regex for all cases (that kind of thing is mandatory in most stuff I have to deal with).

For example, let's say registry returns 3 different is-available responses for 3 different reasons of domain availability:

"Domain not found in DB"
"Domain released for registration"
"Domain expired, returned for availability"

So, instead of putting those 3 lines in json and generally complicate parsing of that json, why not write them as single regex:

"Domain (not found in DB|released for registration|expired, returned for availability)"

Single line, covers all 3 cases.

Now - what about negative match? Say this says domain is not available, and registry returns random gibberish for available domains:

"Domain is registered"

That put in negative regex would be (I might be mistaken here ;) ):

"((?!is registered).)*"

I'm working on active and more-maintained fork, so I want to incorporate as many good changes as possible 😄

$return = true;

if (is_array($not_found_strings)) {
foreach ($not_found_strings as $not_found_string) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to respect the original codestyle when you're making a PR.

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.

9 participants