[wp-hackers] corrected > coding standards and practicality of use.
lists at rotorised.com
Sun Mar 11 04:45:40 UTC 2012
Haluk Karamete wrote:
> So, would you want such string functions to mention the needle or the
> haystack first and if you think $haystack should be mentioned first,
> could you tell me why would you prefer it that way?
PHP is consistent with this, so you should probably aim to be as well.
Array functions are needle, haystack, and string functions are haystack,
> is it better that at the end of the day, when using this framework,
> shoud be endup with
> blp->rightof ?
The latter requires creating an object, which is a bad idea for
something that isn't actually an object. You should be using static
methods, which would make it blp::rightof()
You should definitely not use prefixed functions, as those are a poor
excuse for namespacing, and pollute the global namespace.
> 200 methods wrapped into ablp object?
This is also a bad idea. You should split it into subclasses as
necessary, otherwise it's just going to be a pain in the ass for people
As scribu noted though, you seem to be reinventing the wheel a bit here.
For example, your blp_rightof($str, $char) could be written simply as
substr($str, strpos($char)) - Similarly, a blp_leftof($str, $char) would
be written as substr($str, 0, strpos($char))
Avoid creating wrappers when you don't need to, as it's just going to
confuse everyone involved.
> I could have asked this question in the PHP mailing list but due to
> you guys, this list is my fav.
Regardless, this is still off-topic. You're better off asking on a
general PHP mailing list/forum.
More information about the wp-hackers