03-31-2009, 05:59 AM
|
#24 (permalink)
|
|
The Frequenter
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
|
I notices alot of things, alot of neatpicking but some could really be improved:
- You are using double quotes for many things that doesn't use string interpolation, this is slower because php will seek through the string to find replacables, therefore use single quotes
PHP Code:
@define("PATH_INFO",$_SERVER['PATH_INFO']);
define will *not* emit an error, plus many SAPI's will not define PATH_INFO (for example Apache2 must have AcceptPathInfo = On), I know you have a note above saying so but perhaps find a more cross platform solution if possible
PHP Code:
$url = $route["$url"];
Related to the comment about string interpolation, you don't need php to spend extra time searching the string to replace one value you don't concate with something else, so simply use:
PHP Code:
$url = $route[$url];
PHP Code:
if(!empty($route[preg_replace('/^(\/)/','',$url)]))
without testing it, it looks like this would emit an E_NOTICE because the value may not exist in the $route array
PHP Code:
if(is_array(!empty($plugin)))
This expression is not logical value, the value you pass to is_array() is the value of an expression meaning the value is a boolean and therefore it can never be an array
- , you can use pre/post fixes here, not that it plays a big deal:
PHP Code:
eval("\$_controller->{$url[1]}($arguments);");
this can be very very dangerous, php already supports variable functions, functors and so on, use the call_user_func[_array] functions and don't build arguments in a string but rather an array and run it like:
PHP Code:
call_user_func_array(Array($_controller, $url[1]), $arguments);
That was just a few by reading over the boostrap, I would also use __autoload()/spl_autoload_register() to define an autoloader and load classes only as they are needed. Secondly I would register a default exception handler and then throw exceptions instead of calling $dingo->error() all the time, and then make the exception handler format the error type depending on the exception, SPL offers alot of standard exceptions you can use and they can be found here.
ps. your changelog is a .ini, but its not a real ini file?
Edit; whops, seems like I came to add a bogus entry :)
__________________
Last edited by Kalle : 03-31-2009 at 03:49 PM.
|
|
|