inc/classes/exceptions/io/class_InvalidDataLengthException.php -text
inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php -text
inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php -text
+inc/classes/exceptions/io/class_InvalidResourceException.php -text
inc/classes/exceptions/io/class_PathIsEmptyException.php -text
inc/classes/exceptions/io/class_PathIsNoDirectoryException.php -text
inc/classes/exceptions/io/class_PathReadProtectedException.php -text
inc/classes/exceptions/result/class_ResultUpdateException.php -text
inc/classes/exceptions/socket/.htaccess -text
inc/classes/exceptions/socket/class_InvalidSocketException.php -text
+inc/classes/exceptions/state/.htaccess -text
+inc/classes/exceptions/state/class_InvalidStateException.php -text
inc/classes/exceptions/template/.htaccess -text
inc/classes/exceptions/template/class_BasePathIsEmptyException.php -text
inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php -text
inc/classes/interfaces/resolver/commands/class_CommandResolver.php -text
inc/classes/interfaces/resolver/controller/.htaccess -text
inc/classes/interfaces/resolver/controller/class_ControllerResolver.php -text
+inc/classes/interfaces/resolver/state/.htaccess -text
+inc/classes/interfaces/resolver/state/class_StateResolver.php -text
inc/classes/interfaces/response/.htaccess -text
inc/classes/interfaces/response/class_Responseable.php -text
inc/classes/interfaces/result/.htaccess -text
inc/classes/interfaces/result/class_SearchableResult.php -text
inc/classes/interfaces/result/class_UpdateableResult.php -text
+inc/classes/interfaces/state/.htaccess -text
+inc/classes/interfaces/state/class_Stateable.php -text
inc/classes/interfaces/streams/.htaccess -text
inc/classes/interfaces/streams/class_Streamable.php -text
inc/classes/interfaces/streams/crypto/.htaccess -text
* @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
+ * @deprecated
+ * @see InvalidResourceException
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
--- /dev/null
+<?php
+/**
+ * An exception thrown when a given resource is invalid
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class InvalidResourceException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $class Class throwing this exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public function __construct (FrameworkInterface $class, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Has an invalid resource.",
+ $class->__toString(),
+ $this->getLine()
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * This exception is thrown when the default state is missing
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class InvalidStateException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $msgArray An array with message parts
+ * @param $code An optional code for better debugging
+ * @return void
+ */
+ public function __construct(array $msgArray, $code) {
+ // Prepare the message
+ $message = sprintf("[%s:%d] Cannot resolve state <span class=\"exception_reason\">%s (class name: %s)</span>.",
+ $msgArray[0]->__toString(),
+ $this->getLine(),
+ $msgArray[1],
+ $msgArray[0]->getClassName()
+ );
+
+ // Set extra data
+ $this->setExtraData($msgArray[0]->getClassName().':'.$this->getLine());
+
+ // Call parent contructor with message
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
+<?php
+/**
+ * This exception is thrown when the default state is missing
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class InvalidStateException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $msgArray An array with message parts
+ * @param $code An optional code for better debugging
+ * @return void
+ */
+ public function __construct(array $msgArray, $code) {
+ // Prepare the message
+ $message = sprintf("[%s:%d] Cannot resolve state <span class=\"exception_reason\">%s (class name: %s)</span>.",
+ $msgArray[0]->__toString(),
+ $this->getLine(),
+ $msgArray[1],
+ $msgArray[0]->getClassName()
+ );
+
+ // Set extra data
+ $this->setExtraData($msgArray[0]->getClassName().':'.$this->getLine());
+
+ // Call parent contructor with message
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
+<?php
+/**
+ * This exception is thrown when the default state is missing
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class InvalidStateException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $msgArray An array with message parts
+ * @param $code An optional code for better debugging
+ * @return void
+ */
+ public function __construct(array $msgArray, $code) {
+ // Prepare the message
+ $message = sprintf("[%s:%d] Cannot resolve state <span class=\"exception_reason\">%s (class name: %s)</span>.",
+ $msgArray[0]->__toString(),
+ $this->getLine(),
+ $msgArray[1],
+ $msgArray[0]->getClassName()
+ );
+
+ // Set extra data
+ $this->setExtraData($msgArray[0]->getClassName().':'.$this->getLine());
+
+ // Call parent contructor with message
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
+<?php
+/**
+ * This exception is thrown when the default state is missing
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class InvalidStateException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $msgArray An array with message parts
+ * @param $code An optional code for better debugging
+ * @return void
+ */
+ public function __construct(array $msgArray, $code) {
+ // Prepare the message
+ $message = sprintf("[%s:%d] Cannot resolve state <span class=\"exception_reason\">%s (class name: %s)</span>.",
+ $msgArray[0]->__toString(),
+ $this->getLine(),
+ $msgArray[1],
+ $msgArray[0]->getClassName()
+ );
+
+ // Set extra data
+ $this->setExtraData($msgArray[0]->getClassName().':'.$this->getLine());
+
+ // Call parent contructor with message
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
+<?php
+/**
+ * This exception is thrown when the default state is missing
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class InvalidStateException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $msgArray An array with message parts
+ * @param $code An optional code for better debugging
+ * @return void
+ */
+ public function __construct(array $msgArray, $code) {
+ // Prepare the message
+ $message = sprintf("[%s:%d] Cannot resolve state <span class=\"exception_reason\">%s (class name: %s)</span>.",
+ $msgArray[0]->__toString(),
+ $this->getLine(),
+ $msgArray[1],
+ $msgArray[0]->getClassName()
+ );
+
+ // Set extra data
+ $this->setExtraData($msgArray[0]->getClassName().':'.$this->getLine());
+
+ // Call parent contructor with message
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
+<?php
+/**
+ * This exception is thrown when the default state is missing
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class InvalidStateException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $msgArray An array with message parts
+ * @param $code An optional code for better debugging
+ * @return void
+ */
+ public function __construct(array $msgArray, $code) {
+ // Prepare the message
+ $message = sprintf("[%s:%d] Cannot resolve state <span class=\"exception_reason\">%s (class name: %s)</span>.",
+ $msgArray[0]->__toString(),
+ $this->getLine(),
+ $msgArray[1],
+ $msgArray[0]->getClassName()
+ );
+
+ // Set extra data
+ $this->setExtraData($msgArray[0]->getClassName().':'.$this->getLine());
+
+ // Call parent contructor with message
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
+<?php
+/**
+ * This exception is thrown when the default state is missing
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class InvalidStateException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $msgArray An array with message parts
+ * @param $code An optional code for better debugging
+ * @return void
+ */
+ public function __construct(array $msgArray, $code) {
+ // Prepare the message
+ $message = sprintf("[%s:%d] Cannot resolve state <span class=\"exception_reason\">%s (class name: %s)</span>.",
+ $msgArray[0]->__toString(),
+ $this->getLine(),
+ $msgArray[1],
+ $msgArray[0]->getClassName()
+ );
+
+ // Set extra data
+ $this->setExtraData($msgArray[0]->getClassName().':'.$this->getLine());
+
+ // Call parent contructor with message
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
+<?php
+/**
+ * This exception is thrown when the default state is missing
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class InvalidStateException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $msgArray An array with message parts
+ * @param $code An optional code for better debugging
+ * @return void
+ */
+ public function __construct(array $msgArray, $code) {
+ // Prepare the message
+ $message = sprintf("[%s:%d] Cannot resolve state <span class=\"exception_reason\">%s (class name: %s)</span>.",
+ $msgArray[0]->__toString(),
+ $this->getLine(),
+ $msgArray[1],
+ $msgArray[0]->getClassName()
+ );
+
+ // Set extra data
+ $this->setExtraData($msgArray[0]->getClassName().':'.$this->getLine());
+
+ // Call parent contructor with message
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
+<?php
+/**
+ * This exception is thrown when the default state is missing
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class InvalidStateException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $msgArray An array with message parts
+ * @param $code An optional code for better debugging
+ * @return void
+ */
+ public function __construct(array $msgArray, $code) {
+ // Prepare the message
+ $message = sprintf("[%s:%d] Cannot resolve state <span class=\"exception_reason\">%s (class name: %s)</span>.",
+ $msgArray[0]->__toString(),
+ $this->getLine(),
+ $msgArray[1],
+ $msgArray[0]->getClassName()
+ );
+
+ // Set extra data
+ $this->setExtraData($msgArray[0]->getClassName().':'.$this->getLine());
+
+ // Call parent contructor with message
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An instance for state resolver classes
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface StateResolver extends Resolver {
+ /**
+ * Returns an state instance for a given package class and raw data
+ *
+ * @param $packageInstance An instance of a package class
+ * @param $rawData The raw data to handle
+ * @return $stateInstance An instance of the resolved state
+ */
+ function resolveStateByPackage (Networkable $packageInstance, $rawData);
+
+ /**
+ * Checks wether the given state is valid
+ *
+ * @param $stateName The default state we shall execute
+ * @return $isValid Wether the given state is valid
+ * @throws EmptyVariableException Thrown if given state is not set
+ */
+ function isStateValid ($stateName);
+}
+
+//
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A Stateable interface
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface Stateable extends FrameworkInterface {
+}
+
+//
+?>
const EXCEPTION_WRITE_PROTECED_PATH = 0x018;
const EXCEPTION_DIR_POINTER_INVALID = 0x019;
const EXCEPTION_FILE_POINTER_INVALID = 0x01a;
- const EXCEPTION_INVALID_DIRECTORY_POINTER = 0x01b;
+ const EXCEPTION_INVALID_RESOURCE = 0x01b;
const EXCEPTION_UNEXPECTED_OBJECT = 0x01c;
const EXCEPTION_LIMIT_ELEMENT_IS_UNSUPPORTED = 0x01d;
const EXCEPTION_GETTER_IS_MISSING = 0x01e;
// Set real class
$this->setRealClass($className);
- // Initialize the class if class Registry is there
- if ((class_exists('Registry')) && (Registry::isInitialized() === false)) {
- // Initialize the registry automatically
- $this->initInstance();
+ // Set configuration instance if no registry
+ if (!$this instanceof Register) {
+ // Because registries doesn't need to be configured
+ $this->setConfigInstance(FrameworkConfiguration::getInstance());
} // END - if
}
return null;
}
- /**
- * Private initializer for this class
- *
- * @return void
- */
- private final function initInstance () {
- // Set configuration instance
- $this->setConfigInstance(FrameworkConfiguration::getInstance());
- }
-
/**
* Setter for database result instance
*
* @return $debugInstance Instance to class DebugConsoleOutput or DebugWebOutput
*/
public final function getDebugInstance () {
+ // Get debug instance
$debugInstance = Registry::getRegistry()->getInstance('debug');
+
+ // Return it
return $debugInstance;
}
* @return $dbInstance The database layer instance
*/
public final function getDatabaseInstance () {
- // Default is invalid db instance
- $dbInstance = null;
-
- // Is the registry there and initialized?
- if ((class_exists('Registry')) && (Registry::isInitialized() === true)) {
- $dbInstance = Registry::getRegistry()->getInstance('db_instance');
- } // END - if
+ // Get instance
+ $dbInstance = Registry::getRegistry()->getInstance('db_instance');
// Return instance
return $dbInstance;
* @param $requestInstance An instance of a class with an Requestable interface
* @param $responseInstance An instance of a class with an Responseable interface
* @return void
- * @throws InvalidInterfaceException If the user class does not implement ManageableMember
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
// Get user instance from registry
$userInstance = Registry::getRegistry()->getInstance('user');
- // Does the user instance implement ManageableMember?
- if (!$userInstance instanceof ManageableMember) {
- // Throw exception here
- throw new InvalidInterfaceException(array($userInstance, 'ManageableMember'), self::EXCEPTION_REQUIRED_INTERFACE_MISSING);
- } // END - if
-
// Get an application instance
$appInstance = $this->getResolverInstance()->getApplicationInstance();
*/
public function encryptString ($str) {
// Encrypt the string through the stream
- $encryted = $this->cryptoStreamInstance->encryptStream($str);
+ $encrypted = $this->cryptoStreamInstance->encryptStream($str);
// Return the string
return $encrypted;
protected function __construct ($className) {
// Call parent constructor
parent::__construct($className);
-
- // Clean up a little
- $this->removeNumberFormaters();
}
}
*/
public final static function createLocalFileDatabase ($savePath, FileIoHandler $ioInstance) {
// Get an instance
- $dbInstance = new LocalFileDatabase();
+ $databaseInstance = new LocalFileDatabase();
// Set save path and IO instance
- $dbInstance->setSavePath($savePath);
- $dbInstance->setFileIoInstance($ioInstance);
+ $databaseInstance->setSavePath($savePath);
+ $databaseInstance->setFileIoInstance($ioInstance);
+
+ // Set the compressor channel
+ $databaseInstance->setCompressorChannel(CompressorChannel::createCompressorChannel(
+ $databaseInstance->getConfigInstance()->getConfigEntry('base_path').
+ $databaseInstance->getConfigInstance()->getConfigEntry('compressor_base_path')
+ ));
// "Connect" to the database
- $dbInstance->connectToDatabase();
+ $databaseInstance->connectToDatabase();
// Return database instance
- return $dbInstance;
+ return $databaseInstance;
}
/**
* @return void
*/
public final function setSavePath ($savePath) {
- // Secure string
- $savePath = (string) $savePath;
-
// Set save path
- $this->savePath = $savePath;
+ $this->savePath = (string) $savePath;
}
/**
* @param $requestInstance An instance of a class with an Requestable interface
* @param $responseInstance An instance of a class with an Responseable interface
* @return void
- * @throws NullPointerException If the user instance from registry is null
* @throws FilterChainException If this filter fails to operate
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
// Get a user instance from registry
$userInstance = Registry::getRegistry()->getInstance('user');
- // Is the instance there?
- if (is_null($userInstance)) {
- // Throw an exception here
- throw new NullPointerException ($this, self::EXCEPTION_IS_NULL_POINTER);
- } // END - if
-
// Get the confirm code from user for comparison
$userCode = $userInstance->getField(UserDatabaseWrapper::DB_COLUMN_CONFIRM_HASH);
* @param $linkName Name of the link we shall generate
* @param $linkBase Link base for the link. This parameter is deprecated.
* @return $helperInstance A prepared instance of this helper
- * @throws NullPointerException Thrown if an instance is null
* @throws ConfigEntryNotFoundException A deprecated exception at this point
*/
public final static function createWebLinkHelper (CompileableTemplate $templateInstance, $linkName, $linkBase = null) {
// Get the application instance
$applicationInstance = Registry::getRegistry()->getInstance('application');
- // Sanity-check on it
- if (is_null($applicationInstance)) {
- // Throw an exception here
- throw new NullPointerException($helperInstance, self::EXCEPTION_IS_NULL_POINTER);
- } // END - if
-
// Get the request instance
$requestInstance = $applicationInstance->getRequestInstance();
$this->dirPointer = $dirPointer;
} else {
// Throw exception
- throw new InvalidDirectoryResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
+ throw new InvalidResourceException($this, self::EXCEPTION_INVALID_RESOURCE);
}
}
* @return mixed The result of fread()
* @throws NullPointerException If the file pointer instance
* is not set by setPointer()
- * @throws InvalidFileResourceException If there is being set
+ * @throws InvalidResourceException If there is being set
* an invalid file resource
*/
public function readFromFile () {
throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
} elseif (!is_resource($this->getPointer())) {
// Pointer is not a valid resource!
- throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
+ throw new InvalidResourceException($this, self::EXCEPTION_INVALID_RESOURCE);
}
// Read data from the file pointer and return it
* @return mixed The result of fread()
* @throws NullPointerException If the file pointer instance
* is not set by setPointer()
- * @throws InvalidFileResourceException If there is being set
+ * @throws InvalidResourceException If there is being set
* an invalid file resource
*/
public function readLinesFromFile () {
throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
} elseif (!is_resource($this->getPointer())) {
// Pointer is not a valid resource!
- throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
+ throw new InvalidResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
}
// Read data from the file pointer and return it
* @return void
* @throws NullPointerException If the file pointer instance
* is not set by setPointer()
- * @throws InvalidFileResourceException If there is being set
+ * @throws InvalidResourceException If there is being set
*/
public function closeFile () {
if (is_null($this->getPointer())) {
throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
} elseif (!is_resource($this->getPointer())) {
// Pointer is not a valid resource!
- throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
+ throw new InvalidResourceException($this, self::EXCEPTION_INVALID_RESOURCE);
}
// Close the file pointer and reset the instance variable
$this->filePointer = $filePointer;
} else {
// Throw exception
- throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
+ throw new InvalidResourceException($this, self::EXCEPTION_INVALID_RESOURCE);
}
}
* @return mixed The result of fwrite()
* @throws NullPointerException If the file pointer instance
* is not set by setPointer()
- * @throws InvalidFileResourceException If there is being set
+ * @throws InvalidResourceException If there is being set
* an invalid file resource
*/
public function writeToFile ($dataStream) {
throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
} elseif (!is_resource($this->getPointer())) {
// Pointer is not a valid resource!
- throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
+ throw new InvalidResourceException($this, self::EXCEPTION_INVALID_RESOURCE);
}
// Read data from the file pointer and return it
* @return void
* @throws NullPointerException If the file pointer instance
* is not set by setPointer()
- * @throws InvalidFileResourceException If there is being set
+ * @throws InvalidResourceException If there is being set
*/
public function closeFile () {
if (is_null($this->getPointer())) {
throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
} elseif (!is_resource($this->getPointer())) {
// Pointer is not a valid resource!
- throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
+ throw new InvalidResourceException($this, self::EXCEPTION_INVALID_RESOURCE);
}
// Close the file pointer and reset the instance variable
$this->filePointer = $filePointer;
} else {
// Throw exception
- throw new InvalidFileResourceException($this, self::EXCEPTION_INVALID_DIRECTORY_POINTER);
+ throw new InvalidResourceException($this, self::EXCEPTION_INVALID_RESOURCE);
}
}
*/
private static $registryInstance = null;
- /**
- * Wether the registry is initialized
- */
- private static $initialized = false;
-
/**
* Instance registry
*/
return self::$registryInstance;
}
- /**
- * Checks or sets wether the registry has been initialized. This had only
- * be done once.
- *
- * @param $initialized Wether the registry is initialized
- * @return $initialized Wether the registry is initialized
- */
- public final static function isInitialized ($initialized = null) {
- // If no parameter (null by default) is provided we want to get the
- // parameter. If set to e.g. 'OK' then the registry is set to
- // "initialized".
- if (is_null($initialized)) {
- // Get status if initialized
- return self::$initialized;
- } else {
- // Registry is initialized!
- self::$initialized = true;
- }
- }
-
/**
* Checks wether an instance key was found
*
*
* @param $instanceKey The key to identify the instance
* @return $objectInstance An instance we shall store
+ * @throws NullPointerException If the requested key is not found
*/
public function getInstance ($instanceKey) {
// By default the instance is not in registry
$objectInstance = $this->instanceRegistry[$instanceKey];
} // END - if
+ // Still not fetched?
+ if (is_null($objectInstance)) {
+ // This might happen if a non-registered key was requested
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+ } // END - if
+
// Return the result
return $objectInstance;
}
const EXCEPTION_INVALID_COMMAND = 0x1d0;
const EXCEPTION_INVALID_CONTROLLER = 0x1d1;
const EXCEPTION_INVALID_ACTION = 0x1d2;
+ const EXCEPTION_INVALID_STATE = 0x1d3;
/**
* Protected constructor
// Call parent constructor
parent::__construct(__CLASS__);
- // Set prefix to "Web"
- $this->setCommandPrefix("Web");
+ // Set prefix to 'Web'
+ $this->setCommandPrefix('Web');
}
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set prefix to "Image"
- $this->setControllerPrefix("Image");
+ // Set prefix to 'Image'
+ $this->setControllerPrefix('Image');
}
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set prefix to "Web"
- $this->setControllerPrefix("Web");
+ // Set prefix to 'Web'
+ $this->setControllerPrefix('Web');
}
/**
// Set own instance
self::$thisInstance = $this;
+
+ // Set it so all can use it
+ $this->setDebugInstance($this);
}
/**
} // END - if
}
- /**
- * Fall-back method. Please replace loadClasses() with scanClassPath() !
- *
- * @param $basePath The relative base path to 'base_path' constant for all classes
- * @param $ignoreList An optional list (array forced) of directory and file names which shall be ignored
- * @return void
- * @deprecated
- * @todo Rewrite your apps to scanClassPath()
- */
- public function loadClasses ($basePath, array $ignoreList = array() ) {
- // This outputs an ugly message because you need to change to scanClassPath
- print __METHOD__." is deprecated. Use scanClassPath() to make this warning go away.<br />\n";
-
- // Call our new method
- $this->scanClassPath($basePath, $ignoreList);
- }
-
/**
* Scans recursively a local path for class files which must have a prefix and a suffix as given by $this->suffix and $this->prefix
*
// Try to load these includes in the given order
$configAppIncludes = array(
'class_' . FrameworkConfiguration::getInstance()->getConfigEntry('app_helper_class'), // The ApplicationHelper class
+ 'debug', // Some debugging stuff
+ 'exceptions', // The application's own exception handler
+ 'loader', // The application's class loader
'config', // The application's own configuration
'data', // Application data
'init', // The application initializer
- 'loader', // The application's class loader
- 'debug', // Some debugging stuff
- 'exceptions', // The application's own exception handler
'starter', // The application starter (calls entryPoint(), etc.)
);