Closed taai closed 12 years ago
I agree that late static binding is way faster; however, the reason call_user_func()
and call_user_func_array()
were used was because some users of LEAP were still using PHP 5.2 and lower. I know these users should update, but it was an issue so these functions were used.
It might make sense to integrate these changes in LEAP's 3.3 branch since I think that Kohana 3.3 will be written for PHP 5.3+ users.
In theory, we could make a simple MAKE file to convert 3.3 files back to 3.2 using something like this:
for i in $(find . -type f); do mv "$i" "$(echo $i|tr A-Z a-z)"; done for i in $(find . -type d); do mv "$i" "$(echo $i|tr A-Z a-z)"; done
BTW, we really appreciate ideas on how to improve and optimize LEAP. The more the better.
I was thinking the same about that it's for 5.3+, but I think that I saw something that is for 5.3+, so I tought that we are supporting only 5.3+... If I will find it, I tell you.
About that MAKE file... I think that it would be great to do that, if all code in Leap supports both Kohana 3.2 and 3.3., and if the only thing is the PSR-0 (or what it was called) thing. In that way we could move to 3.3 and "mirror" it to 3.2.
I added Model validation. It's actually ported from Kohana_ORM, with little modifications. I tested it, it worked, I hope I didn't miss something. And, when you are testing this, don't missunderstand this with the issue #50 of another validation - there is a bug in that!
I did implement this on my last commit - in which I took out all these user_call_func
, so, either you take them both, or try to extract the validation code.
If you want me to do it, just ask and I will do that monday.
Ok, I will close this pull request and create a new one.
Don't get mad! I discovered that there is code that can be optimized.
Instead of
you can do
And this is not the only example where
call_user_func()
andcall_user_func_array()
is used when it's actually not needed. Of course, I didn't touch the code where these functions are actualy needed.Why, you may ask. - Because it's more code than needed and it's 4X-8X slower. Here, I wrote a test: https://gist.github.com/3247681
I changed 21 files and I hope that I didn't break anything. :)