Move the Power, Plugin and Module builders into the container. Many more PHP 8 improvments.
This commit is contained in:
@@ -16,7 +16,6 @@ use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Registry;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Counter;
|
||||
|
||||
|
||||
/**
|
||||
@@ -41,9 +40,6 @@ class Compiler implements ServiceProviderInterface
|
||||
|
||||
$container->alias(Registry::class, 'Registry')
|
||||
->share('Registry', [$this, 'getRegistry'], true);
|
||||
|
||||
$container->alias(Counter::class, 'Counter')
|
||||
->share('Counter', [$this, 'getCounter'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,19 +67,6 @@ class Compiler implements ServiceProviderInterface
|
||||
{
|
||||
return new Registry();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Compiler Counter
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Counter
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getCounter(Container $container): Counter
|
||||
{
|
||||
return new Counter();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -15,6 +15,7 @@ namespace VDM\Joomla\Componentbuilder\Compiler\Service;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Joomlamodule\Data as JoomlaModuleData;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Joomlamodule\Builder as JoomlaModuleBuilder;
|
||||
|
||||
|
||||
/**
|
||||
@@ -36,6 +37,9 @@ class Joomlamodule implements ServiceProviderInterface
|
||||
{
|
||||
$container->alias(JoomlaModuleData::class, 'Joomlamodule.Data')
|
||||
->share('Joomlamodule.Data', [$this, 'getJoomlaModuleData'], true);
|
||||
|
||||
$container->alias(JoomlaModuleBuilder::class, 'Joomlamodule.Builder')
|
||||
->share('Joomlamodule.Builder', [$this, 'getJoomlaModuleBuilder'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,6 +65,30 @@ class Joomlamodule implements ServiceProviderInterface
|
||||
$container->get('Dynamicget.Data')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Joomla Module Builder
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return JoomlaModuleBuilder
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getJoomlaModuleBuilder(Container $container): JoomlaModuleBuilder
|
||||
{
|
||||
return new JoomlaModuleBuilder(
|
||||
$container->get('Joomlamodule.Data'),
|
||||
$container->get('Component'),
|
||||
$container->get('Config'),
|
||||
$container->get('Registry'),
|
||||
$container->get('Customcode.Dispenser'),
|
||||
$container->get('Event'),
|
||||
$container->get('Utilities.Counter'),
|
||||
$container->get('Utilities.Folder'),
|
||||
$container->get('Utilities.File'),
|
||||
$container->get('Utilities.Files')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -15,6 +15,7 @@ namespace VDM\Joomla\Componentbuilder\Compiler\Service;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Joomlaplugin\Data as JoomlaPluginData;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Joomlaplugin\Builder as JoomlaPluginBuilder;
|
||||
|
||||
|
||||
/**
|
||||
@@ -36,6 +37,9 @@ class Joomlaplugin implements ServiceProviderInterface
|
||||
{
|
||||
$container->alias(JoomlaPluginData::class, 'Joomlaplugin.Data')
|
||||
->share('Joomlaplugin.Data', [$this, 'getJoomlaPluginData'], true);
|
||||
|
||||
$container->alias(JoomlaPluginBuilder::class, 'Joomlaplugin.Builder')
|
||||
->share('Joomlaplugin.Builder', [$this, 'getJoomlaPluginBuilder'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,6 +63,30 @@ class Joomlaplugin implements ServiceProviderInterface
|
||||
$container->get('Model.Filesfolders')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Joomla Plugin Builder
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return JoomlaPluginBuilder
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getJoomlaPluginBuilder(Container $container): JoomlaPluginBuilder
|
||||
{
|
||||
return new JoomlaPluginBuilder(
|
||||
$container->get('Joomlaplugin.Data'),
|
||||
$container->get('Component'),
|
||||
$container->get('Config'),
|
||||
$container->get('Registry'),
|
||||
$container->get('Customcode.Dispenser'),
|
||||
$container->get('Event'),
|
||||
$container->get('Utilities.Counter'),
|
||||
$container->get('Utilities.Folder'),
|
||||
$container->get('Utilities.File'),
|
||||
$container->get('Utilities.Files')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -14,7 +14,8 @@ namespace VDM\Joomla\Componentbuilder\Compiler\Service;
|
||||
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Library\Data as LibraryData;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Library\Data;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Library\Builder;
|
||||
|
||||
|
||||
/**
|
||||
@@ -34,8 +35,11 @@ class Library implements ServiceProviderInterface
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->alias(LibraryData::class, 'Library.Data')
|
||||
->share('Library.Data', [$this, 'getLibraryData'], true);
|
||||
$container->alias(Data::class, 'Library.Data')
|
||||
->share('Library.Data', [$this, 'getData'], true);
|
||||
|
||||
$container->alias(Builder::class, 'Library.Builder')
|
||||
->share('Library.Builder', [$this, 'getBuilder'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,12 +47,12 @@ class Library implements ServiceProviderInterface
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return LibraryData
|
||||
* @return Data
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getLibraryData(Container $container): LibraryData
|
||||
public function getData(Container $container): Data
|
||||
{
|
||||
return new LibraryData(
|
||||
return new Data(
|
||||
$container->get('Config'),
|
||||
$container->get('Registry'),
|
||||
$container->get('Customcode'),
|
||||
@@ -57,6 +61,29 @@ class Library implements ServiceProviderInterface
|
||||
$container->get('Model.Filesfolders')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Compiler Library Builder
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Builder
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getBuilder(Container $container): Builder
|
||||
{
|
||||
return new Builder(
|
||||
$container->get('Config'),
|
||||
$container->get('Registry'),
|
||||
$container->get('Event'),
|
||||
$container->get('Component'),
|
||||
$container->get('Content'),
|
||||
$container->get('Utilities.Counter'),
|
||||
$container->get('Utilities.Paths'),
|
||||
$container->get('Utilities.Folder'),
|
||||
$container->get('Utilities.File')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -17,6 +17,7 @@ use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Power as Powers;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Power\Infusion;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Power\Autoloader;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Power\Builder;
|
||||
|
||||
|
||||
/**
|
||||
@@ -44,6 +45,9 @@ class Power implements ServiceProviderInterface
|
||||
|
||||
$container->alias(Infusion::class, 'Power.Infusion')
|
||||
->share('Power.Infusion', [$this, 'getInfusion'], true);
|
||||
|
||||
$container->alias(Builder::class, 'Power.Builder')
|
||||
->share('Power.Builder', [$this, 'getBuilder'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,6 +104,29 @@ class Power implements ServiceProviderInterface
|
||||
$container->get('Event')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Compiler Power Builder
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Builder
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getBuilder(Container $container): Builder
|
||||
{
|
||||
return new Builder(
|
||||
$container->get('Power'),
|
||||
$container->get('Config'),
|
||||
$container->get('Registry'),
|
||||
$container->get('Event'),
|
||||
$container->get('Utilities.Counter'),
|
||||
$container->get('Utilities.Paths'),
|
||||
$container->get('Utilities.Folder'),
|
||||
$container->get('Utilities.File'),
|
||||
$container->get('Utilities.Files')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Service;
|
||||
|
||||
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Folder;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\File;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Paths;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Counter;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Files;
|
||||
|
||||
|
||||
/**
|
||||
* Utilities Service Provider
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Utilities implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->alias(Folder::class, 'Utilities.Folder')
|
||||
->share('Utilities.Folder', [$this, 'getFolder'], true);
|
||||
|
||||
$container->alias(File::class, 'Utilities.File')
|
||||
->share('Utilities.File', [$this, 'getFile'], true);
|
||||
|
||||
$container->alias(Counter::class, 'Utilities.Counter')
|
||||
->share('Utilities.Counter', [$this, 'getCounter'], true);
|
||||
|
||||
$container->alias(Paths::class, 'Utilities.Paths')
|
||||
->share('Utilities.Paths', [$this, 'getPaths'], true);
|
||||
|
||||
$container->alias(Files::class, 'Utilities.Files')
|
||||
->share('Utilities.Files', [$this, 'getFiles'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Compiler Folder
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Folder
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getFolder(Container $container): Folder
|
||||
{
|
||||
return new Folder(
|
||||
$container->get('Utilities.Counter'),
|
||||
$container->get('Utilities.File')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Compiler File
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return File
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getFile(Container $container): File
|
||||
{
|
||||
return new File(
|
||||
$container->get('Utilities.Counter')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Compiler Counter
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Counter
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getCounter(Container $container): Counter
|
||||
{
|
||||
return new Counter(
|
||||
$container->get('Content')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Compiler Paths
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Paths
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getPaths(Container $container): Paths
|
||||
{
|
||||
return new Paths(
|
||||
$container->get('Config'),
|
||||
$container->get('Component')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Compiler Files Bucket
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Files
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getFiles(Container $container): Files
|
||||
{
|
||||
return new Files();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user