From 87f159865b77c22625924b2563b0f1f953c09dd1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 7 Feb 2012 20:27:34 +0000 Subject: [PATCH] Many more ore less important changes: - All socket-related exceptions are now extending AbstractSocketException - New socket-related exceptions added (hub project) - Minor improvements, comments improved --- .../class_InvalidServerSocketException.php | 6 ++--- .../socket/class_InvalidSocketException.php | 2 +- .../class_NoSocketRegisteredException.php | 2 +- .../class_SocketConnectionException.php | 8 +++--- .../socket/class_SocketCreationException.php | 6 ++--- .../socket/class_SocketOptionException.php | 8 +++--- .../socket/class_SocketShutdownException.php | 2 +- .../main/console/class_ConsoleTools.php | 2 +- inc/config/class_FrameworkConfiguration.php | 5 +++- inc/loader/class_ClassLoader.php | 25 ++++++++++++------- 10 files changed, 38 insertions(+), 28 deletions(-) diff --git a/inc/classes/exceptions/socket/class_InvalidServerSocketException.php b/inc/classes/exceptions/socket/class_InvalidServerSocketException.php index 98aee08c..165b42b3 100644 --- a/inc/classes/exceptions/socket/class_InvalidServerSocketException.php +++ b/inc/classes/exceptions/socket/class_InvalidServerSocketException.php @@ -21,12 +21,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class InvalidServerSocketException extends FrameworkException { +class InvalidServerSocketException extends AbstractSocketException { /** * A Constructor for this exception * - * @param $messageArray Error message array - * @param $code Error code + * @param $messageArray Error message array + * @param $code Error code * @return void */ public function __construct (array $messageData, $code) { diff --git a/inc/classes/exceptions/socket/class_InvalidSocketException.php b/inc/classes/exceptions/socket/class_InvalidSocketException.php index dc40287a..e7de2fb3 100644 --- a/inc/classes/exceptions/socket/class_InvalidSocketException.php +++ b/inc/classes/exceptions/socket/class_InvalidSocketException.php @@ -22,7 +22,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class InvalidSocketException extends FrameworkException { +class InvalidSocketException extends AbstractSocketException { /** * A Constructor for this exception * diff --git a/inc/classes/exceptions/socket/class_NoSocketRegisteredException.php b/inc/classes/exceptions/socket/class_NoSocketRegisteredException.php index 4278caf2..7b3ed39b 100644 --- a/inc/classes/exceptions/socket/class_NoSocketRegisteredException.php +++ b/inc/classes/exceptions/socket/class_NoSocketRegisteredException.php @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class NoSocketRegisteredException extends FrameworkException { +class NoSocketRegisteredException extends AbstractSocketException { /** * A Constructor for this exception * diff --git a/inc/classes/exceptions/socket/class_SocketConnectionException.php b/inc/classes/exceptions/socket/class_SocketConnectionException.php index c7210108..c16e8f16 100644 --- a/inc/classes/exceptions/socket/class_SocketConnectionException.php +++ b/inc/classes/exceptions/socket/class_SocketConnectionException.php @@ -23,19 +23,19 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class SocketConnectionException extends FrameworkException { +class SocketConnectionException extends AbstractSocketException { /** * A Constructor for this exception * - * @param $messageArray Error message array - * @param $code Error code + * @param $messageArray Error message array + * @param $code Error code * @return void */ public function __construct (array $messageData, $code) { // Construct the message $message = sprintf("[%s:] Could not make a connection, type=%s, errno=%s, errstr=%s", $messageData[0]->__toString(), - $messageData[1], + gettype($messageData[1]), $messageData[2], $messageData[3] ); diff --git a/inc/classes/exceptions/socket/class_SocketCreationException.php b/inc/classes/exceptions/socket/class_SocketCreationException.php index d3260a61..efc9a0ed 100644 --- a/inc/classes/exceptions/socket/class_SocketCreationException.php +++ b/inc/classes/exceptions/socket/class_SocketCreationException.php @@ -23,12 +23,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class SocketCreationException extends FrameworkException { +class SocketCreationException extends AbstractSocketException { /** * A Constructor for this exception * - * @param $messageArray Error message array - * @param $code Error code + * @param $messageArray Error message array + * @param $code Error code * @return void */ public function __construct (array $messageData, $code) { diff --git a/inc/classes/exceptions/socket/class_SocketOptionException.php b/inc/classes/exceptions/socket/class_SocketOptionException.php index a0528277..63213c91 100644 --- a/inc/classes/exceptions/socket/class_SocketOptionException.php +++ b/inc/classes/exceptions/socket/class_SocketOptionException.php @@ -23,19 +23,19 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class SocketOptionException extends FrameworkException { +class SocketOptionException extends AbstractSocketException { /** * A Constructor for this exception * - * @param $messageArray Error message array - * @param $code Error code + * @param $messageArray Error message array + * @param $code Error code * @return void */ public function __construct (array $messageData, $code) { // Construct the message $message = sprintf("[%s:] Changing option on socket failed, type=%s, errno=%s, errstr=%s", $messageData[0]->__toString(), - $messageData[1], + gettype($messageData[1]), $messageData[2], $messageData[3] ); diff --git a/inc/classes/exceptions/socket/class_SocketShutdownException.php b/inc/classes/exceptions/socket/class_SocketShutdownException.php index 256001b1..9ffd6e5d 100644 --- a/inc/classes/exceptions/socket/class_SocketShutdownException.php +++ b/inc/classes/exceptions/socket/class_SocketShutdownException.php @@ -22,7 +22,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class SocketShutdownException extends FrameworkException { +class SocketShutdownException extends AbstractSocketException { /** * A Constructor for this exception * diff --git a/inc/classes/main/console/class_ConsoleTools.php b/inc/classes/main/console/class_ConsoleTools.php index e43c9694..ef97485b 100644 --- a/inc/classes/main/console/class_ConsoleTools.php +++ b/inc/classes/main/console/class_ConsoleTools.php @@ -158,7 +158,7 @@ class ConsoleTools extends BaseFrameworkSystem { // Check if there was an error else if ($errorNo > 0) { // Then throw again - throw new InvalidSocketException(array($helperInstance, gettype($socketResource), $errorNo, $errorStr), BaseListener::EXCEPTION_INVALID_SOCKET); + throw new InvalidSocketException(array($helperInstance, $socketResource, $errorNo, $errorStr), BaseListener::EXCEPTION_INVALID_SOCKET); } // END - if // Prepare the GET request diff --git a/inc/config/class_FrameworkConfiguration.php b/inc/config/class_FrameworkConfiguration.php index 5006ea46..b3bc491f 100644 --- a/inc/config/class_FrameworkConfiguration.php +++ b/inc/config/class_FrameworkConfiguration.php @@ -78,7 +78,7 @@ class FrameworkConfiguration implements Registerable { /** * Setter for default time zone (must be correct!) * - * @param $zone The time-zone string (e.g. Europe/Berlin) + * @param $zone The time-zone string (e.g. Europe/Berlin) * @return void */ public final function setDefaultTimezone ($zone) { @@ -90,6 +90,9 @@ class FrameworkConfiguration implements Registerable { /** * Setter for runtime magic quotes + * + * @param $enableQuotes Whether enable magic runtime quotes (should be disabled for security reasons) + * @return void */ public final function setMagicQuotesRuntime ($enableQuotes) { // Cast it to boolean diff --git a/inc/loader/class_ClassLoader.php b/inc/loader/class_ClassLoader.php index ae5eb6fe..61d5effc 100644 --- a/inc/loader/class_ClassLoader.php +++ b/inc/loader/class_ClassLoader.php @@ -22,6 +22,8 @@ * along with this program. If not, see . * * ---------------------------------- + * 1.4 + * - Some comments improved, other minor improvements * 1.3 * - Constructor is now empty and factory method 'createClassLoader' is created * - renamed loadClasses to scanClassPath @@ -139,9 +141,9 @@ class ClassLoader { } /** - * Our renamed factory method + * Creates an instance of this class loader for given configuration instance * - * @param $configInstance Configuration class instance + * @param $configInstance Configuration class instance * @return void */ public static final function createClassLoader (FrameworkConfiguration $configInstance) { @@ -219,7 +221,7 @@ class ClassLoader { /** * Singleton getter for an instance of this class * - * @return $selfInstance A singleton instance of this class + * @return $selfInstance A singleton instance of this class */ public static final function getSelfInstance () { // Is the instance there? @@ -246,8 +248,11 @@ class ClassLoader { return; } // END - if - // Directories which our class loader ignores by default while - // deep-scanning the directory structure. + /* + * Directories which this class loader ignores by default while + * scanning the whole directory structure starting from given base + * path. + */ $ignoreList[] = '.'; $ignoreList[] = '..'; $ignoreList[] = '.htaccess'; @@ -256,9 +261,11 @@ class ClassLoader { // Keep it in class for later usage $this->ignoreList = $ignoreList; - // Set base directory which holds all our classes, we should use an - // absolute path here so is_dir(), is_file() and so on will always - // find the correct files and dirs. + /* + * Set base directory which holds all our classes, we should use an + * absolute path here so is_dir(), is_file() and so on will always + * find the correct files and dirs. + */ $basePath2 = realpath($basePath); // If the basePath is false it is invalid @@ -312,7 +319,7 @@ class ClassLoader { // Include these extra configs now $this->includeExtraConfigs(); - // Set the prefix back + // Set back the old prefix $this->prefix = $oldPrefix; } -- 2.30.2