inc/classes/main/output/.htaccess -text
inc/classes/main/output/class_ConsoleOutput.php -text
inc/classes/main/output/class_WebOutput.php -text
+inc/classes/main/registry/.htaccess -text
+inc/classes/main/registry/class_Registry.php -text
inc/classes/main/request/.htaccess -text
inc/classes/main/request/class_HttpRequest.php -text
inc/classes/main/resolver/.htaccess -text
);
/**
- * The private constructor. No direct instances can be created from this.
+ * The protected constructor. No direct instances can be created from this.
*
* @return void
*/
*/
class WebShipsimuRegisterCommand extends BaseCommand implements Commandable {
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
private $dataCache = null;
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
*/
class WebDoFormController extends BaseController implements Controller {
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
private $skip = 0;
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
private $lastException = null;
/**
- * The private constructor. Do never instance from outside!
- * You need to set a local file path. The class will then validate it.
+ * The protected constructor. Do never instance from outside! You need to
+ * set a local file path. The class will then validate it.
*
* @return void
*/
*/
class SerializationContainer extends FrameworkArrayObject {
/**
- * Public constructor, if you like to have an object of this class...
+ * Protected constructor, please use the factory method belo!
*
* @return void
*/
- public function __construct () {
+ protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
}
* hold the attributed and their values which we have specified in
* the limitation object.
*
- * @param $limitInstance The instance to the object ObjectLimits
- * @param $object The origin object. We don't touch it here.
- * @return $containerInstance An instance of SerializationContainer
+ * @param $limitInstance The instance to the object ObjectLimits
+ * @param $object The origin object. We don't touch it here.
+ * @return $containerInstance An instance of SerializationContainer
* @throws GetterNotFoundException If a getter was not found
*/
public final static function createSerializationContainer (ObjectLimits $limitInstance, FrameworkInterface $object) {
private $filterInstance = null;
/**
- * Private constructor
+ * Protected constructor
*
* @param $className Name of the real class' name
* @return void
private $filters = array();
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
*/
class EmailValidatorFilter extends BaseFrameworkSystem implements Filterable {
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
/**
* Check wether the email as already been taken
*
- * @param $email Email to check for existence
+ * @param $email Email to check for existence
* @return $alreadyTaken Wether the email has been taken
*/
private function ifEmailIsTaken ($email) {
// Default is already taken
$alreadyTaken = true;
- $this->partialStub(sprintf("Email: %s", $email));
+
+ // Get a registry instance
+ $registry = Registry::getInstance();
+
+ // Is the user already there?
+ if ($registry->keyExists('userInstance')) {
+ // Use the instance for checking for the email
+ $userInstance = $registry->getInstance('userInstance');
+ $userInstance->setEmailAddress($email);
+ } else {
+ // If this instance is created then the username *does* exist
+ $userInstance = User::createUserByEmail($userName);
+
+ // Remember this user instance in our registry for later usage
+ $registry->addInstance('userInstance', $userInstance);
+ }
+
+ // Does the email exist?
+ if (!$userInstance->ifEmailAddressExists()) {
+ // This email has not being used yet
+ $alreadyTaken = false;
+ }
// Return the result
return $alreadyTaken;
*/
class UserNameValidatorFilter extends BaseFrameworkSystem implements Filterable {
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
// Default is already taken
$alreadyTaken = true;
- // Try to create a user instance
- try {
+ // Get a registry instance
+ $registry = Registry::getInstance();
+
+ // Is the user already there?
+ if ($registry->instanceExists('user')) {
+ // Use the instance for checking for the email
+ $userInstance = $registry->getInstance('user');
+ } else {
// If this instance is created then the username *does* exist
$userInstance = User::createUserByUsername($userName);
- } catch (UsernameMissingException $e) {
- // Okay, this user is missing!
+
+ // Remember this user instance in our registry for later usage
+ $registry->addInstance('user', $userInstance);
+ }
+
+ // Does the username exist?
+ if (!$userInstance->ifUsernameExists()) {
+ // This username is still available
$alreadyTaken = false;
}
private $content = "";
/**
- * Private constructor
+ * Protected constructor
*
* @param $className Real name of the class
* @return void
const EXCEPTION_UNEXPECTED_CLOSED_GROUP = 0xb03;
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A registry for several data types
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.3.0
+ * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.mxchange.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 Registry extends BaseFrameworkSystem {
+ /**
+ * Instance of this class
+ */
+ private static $selfInstance = null;
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set part description
+ $this->setObjectDescription("Registry class");
+
+ // Create unique ID number
+ $this->createUniqueID();
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Singleton getter for self instance
+ *
+ * @return $selfInstance Instance of this class
+ */
+ public final static function getInstance () {
+ // Is an instance there?
+ if (is_null(self::$selfInstance)) {
+ // Not yet, so create one
+ self::$selfInstance = new Registry();
+ }
+
+ // Return the instance
+ return self::$selfInstance;
+ }
+}
+
+// [EOF]
+?>
private $resultArray = array();
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
const EXCEPTION_USERNAME_NOT_FOUND = 0xd00;
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
*/
class BaseMiddleware extends BaseFrameworkSystem {
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class CompressorChannel extends BaseMiddleware {
- // Output handler instance
+ /**
+ * Real compressor instance
+ */
private $compressor = null;
- // Public constructor
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
protected function __construct () {
// Call parent constructor!
parent::__construct(__CLASS__);
$this->createUniqueID();
}
- // Create a new compressor channel based a given compression handler
+ /**
+ * Create a new compressor channel based a given base directory where
+ * we shall look for compressor classes
+ *
+ * @param $baseDir Directory which holds our compressor classes
+ * @return $cInstance A prepared instance of this class
+ */
public final static function createCompressorChannel ($baseDir) {
// Get new instance
$cInstance = new CompressorChannel();
private static $thisInstance = null;
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/