-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[4.0] Load the component dispatcher through the ComponentInterface (#…
…19811) * Load dispatcher as service * Reove obsolete * dispatcher * dispatcher service provider * Dispatcher factory * CS * doc block * doc block * imports * Revert * CS * Make drone happy * CS * Load the option correctly
- Loading branch information
Showing
11 changed files
with
211 additions
and
21 deletions.
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