私はOOPに少し慣れていないので、自分のアプリケーションの「フレームワーク」に取り組んでいます。以下のような独自の自動ロード関数と、例外処理オブジェクトがあります。サードパーティのプラグインは使用しません(少なくとも私は思いません)。
最初の質問:オートロードで例外処理を気にする必要がありますか、それとも単にやり過ぎですか?
2番目の質問:私のexceptionHandlerクラスはパブリック関数です...他の多くのアプリケーションで使用されるものなので、これは正しいですか?ありがとうございました。
ありがとう..どんな入力でも大歓迎です。
function __autoload( $class ){
// Define filename pattern to include
$filename = $_SERVER['DOCUMENT_ROOT'] . '/../app/core/models/' . $class . '.class.php';
// Require class if it exists
try {
if ( is_readable( $filename ) ) {
require_once ( $filename );
}
else {
throw new Exception( "Class filename doesn't exist or isn't named correctly: $filename" );
}
}
catch ( Exception $e ) {
// Send to exceptionHandler Class for logging/handling.
$err = new exceptionHandler( $e, 3 );
}
}