33
0
mirror of https://github.com/joomla-extensions/patchtester.git synced 2025-02-14 01:30:21 +00:00

Break controller class inheritance

This commit is contained in:
Michael Babker 2019-08-27 19:50:21 -05:00
parent 6ae47e8b4a
commit 5537bcfe1f
2 changed files with 38 additions and 9 deletions

View File

@ -8,20 +8,26 @@
namespace PatchTester\Controller;
use Joomla\Application\AbstractApplication;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\Input\Input;
use Joomla\Registry\Registry;
/**
* Base controller for the patch testing component
*
* @since 2.0
*
* @method CMSApplication getApplication() getApplication() Get the application object.
*/
abstract class AbstractController extends \JControllerBase
abstract class AbstractController
{
/**
* The active application
*
* @var CMSApplication
* @since __DEPLOY_VERSION__
*/
protected $app;
/**
* The object context
*
@ -41,19 +47,42 @@ abstract class AbstractController extends \JControllerBase
/**
* Instantiate the controller
*
* @param \JInput $input The input object.
* @param AbstractApplication $app The application object.
* @param CMSApplication $app The application object.
*
* @since 2.0
*/
public function __construct(\JInput $input = null, AbstractApplication $app = null)
public function __construct(CMSApplication $app)
{
parent::__construct($input, $app);
$this->app = $app;
// Set the context for the controller
$this->context = 'com_patchtester.' . $this->getInput()->getCmd('view', $this->defaultView);
}
/**
* Get the application object.
*
* @return CMSApplication
*
* @since __DEPLOY_VERSION__
*/
public function getApplication()
{
return $this->app;
}
/**
* Get the input object.
*
* @return Input
*
* @since __DEPLOY_VERSION__
*/
public function getInput()
{
return $this->app->input;
}
/**
* Sets the state for the model object
*

View File

@ -40,5 +40,5 @@ if (!class_exists($class))
// Instantiate and execute the controller
/** @var \PatchTester\Controller\AbstractController $controller */
$controller = new $class($app->input, $app);
$controller = new $class($app);
$controller->execute();