-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.0] Load the component dispatcher through the ComponentInterface #19811
Merged
wilsonge
merged 15 commits into
joomla:4.0-dev
from
Digital-Peak:j4/components/service/dispatcher
Mar 4, 2018
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
0f1f096
Load dispatcher as service
laoneo 22e8f05
Merge remote-tracking branch 'remotes/upstream/4.0-dev' into j4/compo…
laoneo 51c46f2
Reove obsolete
laoneo 68e1bb2
dispatcher
laoneo a0acdb6
dispatcher service provider
laoneo 9a46607
Dispatcher factory
laoneo f21a961
CS
laoneo 276825d
doc block
laoneo 2f4c650
doc block
laoneo 6319f11
imports
laoneo d4a1d6e
Revert
laoneo 6b7efe8
CS
laoneo d442435
Make drone happy
laoneo 87b884a
CS
laoneo 8441dd7
Load the option correctly
laoneo File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
/** | ||
* Joomla! Content Management System | ||
* | ||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE | ||
*/ | ||
|
||
namespace Joomla\CMS\Dispatcher; | ||
|
||
defined('_JEXEC') or die; | ||
|
||
use Joomla\CMS\Application\CMSApplicationInterface; | ||
|
||
/** | ||
* Namesapce based implementation of the DispatcherFactoryInterface | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
class DispatcherFactory implements DispatcherFactoryInterface | ||
{ | ||
/** | ||
* The extension namespace | ||
* | ||
* @var string | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
protected $namespace; | ||
|
||
/** | ||
* DispatcherFactory constructor. | ||
* | ||
* @param string $namespace The namespace | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public function __construct(string $namespace) | ||
{ | ||
$this->namespace = $namespace; | ||
} | ||
|
||
/** | ||
* Creates a dispatcher. | ||
* | ||
* @param CMSApplicationInterface $application The application | ||
* | ||
* @return DispatcherInterface | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public function createDispatcher(CMSApplicationInterface $application): DispatcherInterface | ||
{ | ||
$name = 'Site'; | ||
|
||
if ($application->isClient('administrator')) | ||
{ | ||
$name = 'Administrator'; | ||
} | ||
|
||
$className = '\\' . trim($this->namespace, '\\') . '\\' . $name . '\\Dispatcher\\Dispatcher'; | ||
|
||
return new $className($application, $application->input); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Libraries | ||
* @subpackage Dispatcher | ||
* | ||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE | ||
*/ | ||
|
||
namespace Joomla\CMS\Dispatcher; | ||
|
||
defined('_JEXEC') or die; | ||
|
||
use Joomla\CMS\Application\CMSApplicationInterface; | ||
|
||
/** | ||
* Dispatcher factory interface | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
interface DispatcherFactoryInterface | ||
{ | ||
/** | ||
* Creates a dispatcher. | ||
* | ||
* @param CMSApplicationInterface $application The application | ||
* | ||
* @return DispatcherInterface | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public function createDispatcher(CMSApplicationInterface $application): DispatcherInterface; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to access frontend and backend dispatchers here I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean without a factory? I had that on a first version but moved to a factory because we will not be able to inject the application from the ComponenHelper, instead of its the one from the container. It leads then to an assumption that the app in the ComponentHelper is the same as in the container.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I'm just being stupid :)