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

Maybe I don't understand what this lines does, but... #13

Open
joedevon opened this issue Dec 13, 2011 · 3 comments
Open

Maybe I don't understand what this lines does, but... #13

joedevon opened this issue Dec 13, 2011 · 3 comments

Comments

@joedevon
Copy link
Contributor

$rules = (isset($options['rules']['rule'])) ? array($options['rules']) : $options['rules'];

So if $options['rules']['rule'] exists, which means $options['rules'] is an array, then cast $options['rules'] to an array and pass that value to $rules.

Otherwise, clearly $options['rules'] is not an array, therefore just pass it to $rules.

Isn't that the same as:

$rules = $options['rules']

?

Am I missing something?

(Sometimes my tone gets misunderstood on the Internet so to be clear, I'm not being snarky. Just want to clarify.)

@tmaiaroto
Copy link
Owner

It's ok! I appreciate the enthusiasm and interest. You can fork this and submit a pull request / patch if you like. I'm super swamped and just can't get to all the things I'd like to unfortunately. Thanks for your feedback.

@joedevon
Copy link
Contributor Author

No need to. I read it wrong.

It isn't casting to an array, it's just adding it to an empty array.
Not totally clear why you're doing it (yet), but after some testing I can see that there was a purpose there.

@tmaiaroto
Copy link
Owner

You know, it's been a while, but all that I can remember (fuzzy) is that I wanted to allow it to accept a single rule or multiple...Each rule itself is an array though.

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

2 participants