Re: [CALL FOR VOTES] File_IMC
| From: | Davey | Date: | Tue, 30 Sep 2003 15:21:29 +0000 |
| Subject: | Re: [CALL FOR VOTES] File_IMC | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-22223@lists.php.net to get a copy of this message | ||
Paul M Jones wrote:
Hi, everyone, In reference to the File_IMC proposal [1] we are now calling for votes on the package.acount: Davey Vote: 0 Review: code review and example review I have not voted +1 because there is one problem which you can easily fix. the build method should be like so IMNSHO:
function build($format, $version = null)
{
$filename = 'File/IMC/Build/'. $format . '.php';
$classname = 'File_IMC_Build_'. $format;
if (file_exists($filename)) {
include_once $filename;
} else {
return File_IMC::raiseError(
'No builder driver exists for format: ' . $format,
FILE_IMC_ERROR_INVALID_DRIVER);
}
if ($version !== null) {
$class = new $classname($version);
} else {
$class = new $classname;
}
return $class;
}
You should check if the file_exists() before the include, rather than class_exists after so as to avoid any PHP E_NOTICE errors as you are raising your own error. You may want to do a class_exists() AS WELL after the include just to be sure its the right file or what not.
Just my $0.02 - sorry if this should have been said sooner (i.e. before the voting). If you can change this, you have my +1
I do like the class otherwise, and look forward to working with you on the ical stuff :)
- Davey