note 21067 rejected from language.oop.constructor by alindeman

From: Date: Sat, 27 Apr 2002 18:18:31 +0000
Subject: note 21067 rejected from language.oop.constructor by alindeman
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-29927@lists.php.net to get a copy of this message
Can you validate the construction process? I'm creating a "Folder" class. The constructor should check if the path passed to him is valid, and if not he should refuse to create that instance of the class. I'm returning "false" right now from the constructor when the correctness is not met, but I'm not very sure who receives this result. If I do: $F = new Folder($path); $F has the result of a return in Folder($path)? And what if for some (maybe stupid) reason I retun something more than "false"? $F ends being the object I want or the value passed by the constructor's return?

« previous php.notes (#29927) next »