Skip to content
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

[5.x][RFC] CMSPlugin: Lazy subscriber interface and decorator #43658

Open
wants to merge 16 commits into
base: 5.2-dev
Choose a base branch
from
Next Next commit
LazyServiceEventSubscriber
  • Loading branch information
Fedik committed Jun 9, 2024
commit 6b63a155cfb83066b9099c415463c9de935d895b
55 changes: 55 additions & 0 deletions libraries/src/Event/LazyServiceEventSubscriber.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

/**
* Joomla! Content Management System
*
* @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\CMS\Event;

use Psr\Container\ContainerInterface;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
* Class for lazy subscribers
*
* @since __DEPLOY_VERSION__
*/
class LazyServiceEventSubscriber
{
/**
* The service container
*
* @var ContainerInterface
* @since __DEPLOY_VERSION__
*/
private $container;

/**
* Listener class name
*
* @var string
* @since __DEPLOY_VERSION__
*/
private $class;

/**
* Constructor.
*
* @param \Psr\Container\ContainerInterface $container Container
* @param string $class Listener class name
*
* @since __DEPLOY_VERSION__
*/
public function __construct(ContainerInterface $container, string $class)
{
$this->container = $container;
$this->class = $class;
}

}