<?php
// Own namespace
-namespace CoreFramework\Resolver\Controller;
+namespace Org\Mxchange\CoreFramework\Resolver\Controller;
// Import framework stuff
-use CoreFramework\Controller\DefaultControllerException;
-use CoreFramework\Controller\Controller;
-use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Generic\EmptyVariableException;
-use CoreFramework\Resolver\BaseResolver;
-use CoreFramework\Resolver\Controller\ControllerResolver;
+use Org\Mxchange\CoreFramework\Controller\DefaultControllerException;
+use Org\Mxchange\CoreFramework\Controller\Controller;
+use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Registry\Registry;
+use Org\Mxchange\CoreFramework\Resolver\BaseResolver;
+use Org\Mxchange\CoreFramework\Resolver\Controller\ControllerResolver;
+
+// Import SPL stuff
+use \InvalidArgumentException;
+
/**
* A generic controller resolver class
*
* 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 BaseControllerResolver extends BaseResolver {
+abstract class BaseControllerResolver extends BaseResolver {
/**
* Protected constructor
*
$resolverConfigEntry,
array(
$controllerName,
- $this->getApplicationInstance()
+ Registry::getRegistry()->getInstance('app')
)
);
$controllerInstance = ObjectFactory::createObjectByName(
* @param $namespace Namespace to look in, no trailing backslash
* @param $controllerName The default controller we shall execute
* @return $isValid Whether the given controller is valid
- * @throws EmptyVariableException Thrown if given controller is not set
+ * @throws InvalidArgumentException Thrown if given controller is not set
* @throws DefaultControllerException Thrown if default controller was not found
*/
protected function isControllerValid ($namespace, $controllerName) {
// By default nothing shall be valid
- $isValid = FALSE;
+ $isValid = false;
// Is namespace and controller name set?
if (empty($namespace)) {
// Then thrown an exception here
- throw new EmptyVariableException(array($this, 'namespace'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ throw new InvalidArgumentException('Parameter "namespace" is empty');
} elseif (empty($controllerName)) {
// Then thrown an exception here
- throw new EmptyVariableException(array($this, 'controllerName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } // END - if
+ throw new InvalidArgumentException('Parameter "controllerName" is empty');
+ }
// Create class name
$className = sprintf(
$this->setClassName($className);
// Try it hard to get an controller
- while ($isValid === FALSE) {
+ while ($isValid === false) {
// Is this class already loaded?
if (class_exists($this->getClassName())) {
// This class does exist. :-)
- $isValid = TRUE;
+ $isValid = true;
} elseif ($this->getClassName() != $newsControllerName) {
// Set default controller
$this->setClassName($newsControllerName);