+++ /dev/null
-<?php
-// Own namespace
-namespace CoreFramework\Factory\Stack;
-
-// Import framework stuff
-use CoreFramework\Configuration\FrameworkConfiguration;
-use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Registry\Registry;
-
-/**
- * A factory class for file-based stacks
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 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 FileStackFactory extends ObjectFactory {
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-
- /**
- * Returns a singleton (registry-based) StackableFile instance
- *
- * @param $prefix Class prefix
- * @param $stackName Name of the stack
- * @return $stackInstance An instance of a StackableFile class
- */
- public static final function createFileStackInstance ($prefix, $stackName) {
- // Construct file stack name
- $stackFileName = sprintf('%s%s/%s.%s',
- FrameworkConfiguration::getSelfInstance()->getConfigEntry('base_path'),
- FrameworkConfiguration::getSelfInstance()->getConfigEntry('base_file_stacks_path'),
- $stackName,
- FrameworkConfiguration::getSelfInstance()->getConfigEntry('file_stacks_extension')
- );
-
- // If there is no handler?
- if (Registry::getRegistry()->instanceExists($stackName . '_stack')) {
- // Get handler from registry
- $stackInstance = Registry::getRegistry()->getInstance($stackName . '_stack');
- } else {
- // Get the handler instance
- $stackInstance = self::createObjectByConfiguredName($prefix . '_' . $stackName . '_stack_class', array($stackFileName, $prefix . '_' . $stackName));
-
- // Add it to the registry
- Registry::getRegistry()->addInstance($stackName . '_stack', $stackInstance);
- }
-
- // Return the instance
- return $stackInstance;
- }
-
-}