Skip to content

Commit 8163a49

Browse files
committed
Rework CMS Application tree
1 parent f27a66d commit 8163a49

File tree

3 files changed

+68
-15
lines changed

3 files changed

+68
-15
lines changed

libraries/src/Application/CMSApplicationInterface.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@
88

99
namespace Joomla\CMS\Application;
1010

11+
use Joomla\Application\ConfigurationAwareApplicationInterface;
1112
use Joomla\CMS\Extension\ExtensionManagerInterface;
1213
use Joomla\CMS\Menu\AbstractMenu;
1314
use Joomla\CMS\User\User;
14-
use Joomla\Session\SessionInterface;
15+
use Joomla\Input\Input;
1516

1617
/**
1718
* Interface defining a Joomla! CMS Application class
1819
*
1920
* @since 4.0.0
21+
* @note In Joomla 4 this interface will no longer extend EventAwareInterface
22+
* @property-read Input $input The Joomla Input property. Deprecated for Joomla 5 in favour of the getInput() method
2023
*/
21-
interface CMSApplicationInterface extends ExtensionManagerInterface
24+
interface CMSApplicationInterface extends ExtensionManagerInterface, ConfigurationAwareApplicationInterface, EventAwareInterface
2225
{
2326
/**
2427
* Constant defining an enqueued emergency message
@@ -105,15 +108,6 @@ public function enqueueMessage($msg, $type = self::MSG_INFO);
105108
*/
106109
public function getMessageQueue();
107110

108-
/**
109-
* Execute the application.
110-
*
111-
* @return void
112-
*
113-
* @since 4.0.0
114-
*/
115-
public function execute();
116-
117111
/**
118112
* Check the client interface by name.
119113
*
@@ -146,6 +140,15 @@ public function isCli();
146140
*/
147141
public function getIdentity();
148142

143+
/**
144+
* Method to get the application input object.
145+
*
146+
* @return Input
147+
*
148+
* @since __DEPLOY_VERSION__
149+
*/
150+
public function getInput(): Input;
151+
149152
/**
150153
* Gets the name of the current running application.
151154
*
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* Joomla! Content Management System
4+
*
5+
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
6+
* @license GNU General Public License version 2 or later; see LICENSE
7+
*/
8+
9+
namespace Joomla\CMS\Application;
10+
11+
use Joomla\Event\DispatcherAwareInterface;
12+
use Joomla\Event\DispatcherInterface;
13+
use Joomla\Event\Event;
14+
15+
/**
16+
* Interface defining application that can throw Joomla 3.x style events
17+
*
18+
* @since 4.0.0
19+
* @deprecated 5.0 This interface will be removed as the Joomla 3.x compatibility layer will be removed
20+
*/
21+
interface EventAwareInterface extends DispatcherAwareInterface
22+
{
23+
/**
24+
* Get the event dispatcher.
25+
*
26+
* @return DispatcherInterface
27+
*
28+
* @since 4.0.0
29+
* @throws \UnexpectedValueException May be thrown if the dispatcher has not been set.
30+
*/
31+
public function getDispatcher();
32+
33+
/**
34+
* Calls all handlers associated with an event group.
35+
*
36+
* This is a legacy method, implementing old-style (Joomla! 3.x) plugin calls. It's best to go directly through the
37+
* Dispatcher and handle the returned EventInterface object instead of going through this method. This method is
38+
* deprecated and will be removed in Joomla! 5.x.
39+
*
40+
* This method will only return the 'result' argument of the event
41+
*
42+
* @param string $eventName The event name.
43+
* @param array|Event $args An array of arguments or an Event object (optional).
44+
*
45+
* @return array An array of results from each function call. Note this will be an empty array if no dispatcher is set.
46+
*
47+
* @since 4.0.0
48+
* @throws \InvalidArgumentException
49+
* @deprecated 5.0
50+
*/
51+
public function triggerEvent($eventName, $args = []);
52+
}

libraries/src/Application/WebApplication.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
use Joomla\CMS\Uri\Uri;
2121
use Joomla\CMS\User\User;
2222
use Joomla\CMS\Version;
23-
use Joomla\Event\DispatcherAwareInterface;
24-
use Joomla\Event\DispatcherAwareTrait;
2523
use Joomla\Registry\Registry;
2624
use Joomla\Session\SessionEvent;
2725
use Psr\Http\Message\ResponseInterface;
@@ -31,9 +29,9 @@
3129
*
3230
* @since 2.5.0
3331
*/
34-
abstract class WebApplication extends AbstractWebApplication implements DispatcherAwareInterface
32+
abstract class WebApplication extends AbstractWebApplication
3533
{
36-
use DispatcherAwareTrait, EventAware, IdentityAware;
34+
use EventAware, IdentityAware;
3735

3836
/**
3937
* The application document object.

0 commit comments

Comments
 (0)