Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions libraries/src/Application/CMSApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

\defined('JPATH_PLATFORM') or die;

use Joomla\Application\SessionAwareWebApplicationInterface;
use Joomla\Application\SessionAwareWebApplicationTrait;
use Joomla\Application\Web\WebClient;
use Joomla\CMS\Authentication\Authentication;
Expand Down Expand Up @@ -43,7 +42,7 @@
*
* @since 3.2
*/
abstract class CMSApplication extends WebApplication implements ContainerAwareInterface, CMSApplicationInterface, SessionAwareWebApplicationInterface
abstract class CMSApplication extends WebApplication implements ContainerAwareInterface, CMSWebApplicationInterface
{
use ContainerAwareTrait, ExtensionManagerTrait, ExtensionNamespaceMapper, SessionAwareWebApplicationTrait;

Expand Down Expand Up @@ -1062,7 +1061,7 @@ protected function route()
* @param string $key The path of the state.
* @param mixed $value The value of the variable.
*
* @return mixed The previous state, if one existed.
* @return mixed|void The previous state, if one existed.
*
* @since 3.2
*/
Expand Down
33 changes: 12 additions & 21 deletions libraries/src/Application/CMSApplicationInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@

namespace Joomla\CMS\Application;

use Joomla\Application\ConfigurationAwareApplicationInterface;
use Joomla\CMS\Extension\ExtensionManagerInterface;
use Joomla\CMS\Menu\AbstractMenu;
use Joomla\CMS\User\User;
use Joomla\Session\SessionInterface;
use Joomla\Input\Input;

/**
* Interface defining a Joomla! CMS Application class
*
* @since 4.0.0
* @note In Joomla 5 this interface will no longer extend EventAwareInterface
* @property-read Input $input {@deprecated 5.0} The Joomla Input property. Deprecated in favour of getInput()
*/
interface CMSApplicationInterface extends ExtensionManagerInterface
interface CMSApplicationInterface extends ExtensionManagerInterface, ConfigurationAwareApplicationInterface, EventAwareInterface
{
/**
* Constant defining an enqueued emergency message
Expand Down Expand Up @@ -105,15 +108,6 @@ public function enqueueMessage($msg, $type = self::MSG_INFO);
*/
public function getMessageQueue();

/**
* Execute the application.
*
* @return void
*
* @since 4.0.0
*/
public function execute();

/**
* Check the client interface by name.
*
Expand Down Expand Up @@ -147,25 +141,22 @@ public function isCli();
public function getIdentity();

/**
* Gets the name of the current running application.
* Method to get the application input object.
*
* @return string The name of the application.
* @return Input
*
* @since 4.0.0
* @since __DEPLOY_VERSION__
*/
public function getName();
public function getInput(): Input;

/**
* Get the menu object.
*
* @param string $name The application name for the menu
* @param array $options An array of options to initialise the menu with
* Gets the name of the current running application.
*
* @return AbstractMenu|null An AbstractMenu object or null if not set.
* @return string The name of the application.
*
* @since 4.0.0
*/
public function getMenu($name = null, $options = array());
public function getName();

/**
* Allows the application to load a custom or default identity.
Expand Down
82 changes: 82 additions & 0 deletions libraries/src/Application/CMSWebApplicationInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/

namespace Joomla\CMS\Application;

\defined('JPATH_PLATFORM') or die;

use Joomla\Application\SessionAwareWebApplicationInterface;
use Joomla\CMS\Document\Document;
use Joomla\CMS\Menu\AbstractMenu;

/**
* Interface defining a Joomla! CMS Application class for web applications.
*
* @since __DEPLOY_VERSION__
*/
interface CMSWebApplicationInterface extends SessionAwareWebApplicationInterface, CMSApplicationInterface
{
/**
* Method to get the application document object.
*
* @return Document The document object
*
* @since __DEPLOY_VERSION__
*/
public function getDocument();

/**
* Get the menu object.
*
* @param string $name The application name for the menu
* @param array $options An array of options to initialise the menu with
*
* @return AbstractMenu|null An AbstractMenu object or null if not set.
*
* @since __DEPLOY_VERSION__
*/
public function getMenu($name = null, $options = array());

/**
* Gets a user state.
*
* @param string $key The path of the state.
* @param mixed $default Optional default value, returned if the internal value is null.
*
* @return mixed The user state or null.
*
* @since __DEPLOY_VERSION__
*/
public function getUserState($key, $default = null);

/**
* Gets the value of a user state variable.
*
* @param string $key The key of the user state variable.
* @param string $request The name of the variable passed in a request.
* @param string $default The default value for the variable if not found. Optional.
* @param string $type Filter for the variable, for valid values see {@link InputFilter::clean()}. Optional.
*
* @return mixed The request user state.
*
* @since __DEPLOY_VERSION__
*/
public function getUserStateFromRequest($key, $request, $default = null, $type = 'none');

/**
* Sets the value of a user state variable.
*
* @param string $key The path of the state.
* @param mixed $value The value of the variable.
*
* @return mixed|void The previous state, if one existed. Void otherwise.
*
* @since __DEPLOY_VERSION__
*/
public function setUserState($key, $value);
}
17 changes: 1 addition & 16 deletions libraries/src/Application/ConsoleApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public function getName(): string
/**
* Get the commands which should be registered by default to the application.
*
* @return \Joomla\Console\CommandInterface[]
* @return \Joomla\Console\Command\AbstractCommand[]
*
* @since 4.0.0
*/
Expand Down Expand Up @@ -368,19 +368,4 @@ public function setSession(SessionInterface $session): self

return $this;
}

/**
* Returns the application \JMenu object.
*
* @param string $name The name of the application/client.
* @param array $options An optional associative array of configuration settings.
*
* @return null
*
* @since 4.0.0
*/
public function getMenu($name = null, $options = array())
{
return null;
}
}
52 changes: 52 additions & 0 deletions libraries/src/Application/EventAwareInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/

namespace Joomla\CMS\Application;

use Joomla\Event\DispatcherAwareInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Event\Event;

/**
* Interface defining application that can trigger Joomla 3.x style events
*
* @since 4.0.0
* @deprecated 5.0 This interface will be removed as the Joomla 3.x compatibility layer will be removed
*/
interface EventAwareInterface extends DispatcherAwareInterface
{
/**
* Get the event dispatcher.
*
* @return DispatcherInterface
*
* @since 4.0.0
* @throws \UnexpectedValueException May be thrown if the dispatcher has not been set.
*/
public function getDispatcher();

/**
* Calls all handlers associated with an event group.
*
* This is a legacy method, implementing old-style (Joomla! 3.x) plugin calls. It's best to go directly through the
* Dispatcher and handle the returned EventInterface object instead of going through this method. This method is
* deprecated and will be removed in Joomla! 5.x.
*
* This method will only return the 'result' argument of the event
*
* @param string $eventName The event name.
* @param array|Event $args An array of arguments or an Event object (optional).
*
* @return array An array of results from each function call. Note this will be an empty array if no dispatcher is set.
*
* @since 4.0.0
* @throws \InvalidArgumentException
* @deprecated 5.0
*/
public function triggerEvent($eventName, $args = []);
}
6 changes: 2 additions & 4 deletions libraries/src/Application/WebApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\User\User;
use Joomla\CMS\Version;
use Joomla\Event\DispatcherAwareInterface;
use Joomla\Event\DispatcherAwareTrait;
use Joomla\Registry\Registry;
use Joomla\Session\SessionEvent;
use Psr\Http\Message\ResponseInterface;
Expand All @@ -31,9 +29,9 @@
*
* @since 2.5.0
*/
abstract class WebApplication extends AbstractWebApplication implements DispatcherAwareInterface
abstract class WebApplication extends AbstractWebApplication
{
use DispatcherAwareTrait, EventAware, IdentityAware;
use EventAware, IdentityAware;

/**
* The application document object.
Expand Down