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

joedevon opened this Issue Dec 13, 2011 · 3 comments


None yet

2 participants

$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.)


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.


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.


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