Moves all major structre function to container. Adds new Server replacment class for legacy calls. Refactored multiple classes. Add more advanced compiler options, with donation notice.

This commit is contained in:
2023-02-12 21:15:41 +02:00
parent 7fa8964b44
commit 339aec221e
58 changed files with 4552 additions and 1755 deletions

View File

@@ -16,6 +16,7 @@ use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Componentbuilder\Compiler\Config;
use VDM\Joomla\Componentbuilder\Compiler\Registry;
use VDM\Joomla\Componentbuilder\Table;
/**
@@ -40,6 +41,9 @@ class Compiler implements ServiceProviderInterface
$container->alias(Registry::class, 'Registry')
->share('Registry', [$this, 'getRegistry'], true);
$container->alias(Table::class, 'Table')
->share('Table', [$this, 'getTable'], true);
}
/**
@@ -67,6 +71,20 @@ class Compiler implements ServiceProviderInterface
{
return new Registry();
}
/**
* Get the Table
*
* @param Container $container The DI container.
*
* @return Table
* @since 3.2.0
*/
public function getTable(Container $container): Table
{
return new Table();
}
}

View File

@@ -14,9 +14,14 @@ namespace VDM\Joomla\Componentbuilder\Compiler\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Componentbuilder\Compiler\Component as ComponentObject;
use VDM\Joomla\Componentbuilder\Compiler\Component\Placeholder as ComponentPlaceholder;
use VDM\Joomla\Componentbuilder\Compiler\Component\Data as ComponentData;
use VDM\Joomla\Componentbuilder\Compiler\Component as CompilerComponent;
use VDM\Joomla\Componentbuilder\Compiler\Component\Settings;
use VDM\Joomla\Componentbuilder\Compiler\Component\Dashboard;
use VDM\Joomla\Componentbuilder\Compiler\Component\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Component\Data;
use VDM\Joomla\Componentbuilder\Compiler\Component\Structure;
use VDM\Joomla\Componentbuilder\Compiler\Component\Structuresingle;
use VDM\Joomla\Componentbuilder\Compiler\Component\Structuremultiple;
/**
@@ -36,14 +41,29 @@ class Component implements ServiceProviderInterface
*/
public function register(Container $container)
{
$container->alias(ComponentObject::class, 'Component')
$container->alias(CompilerComponent::class, 'Component')
->share('Component', [$this, 'getComponent'], true);
$container->alias(ComponentPlaceholder::class, 'Component.Placeholder')
->share('Component.Placeholder', [$this, 'getComponentPlaceholder'], true);
$container->alias(Settings::class, 'Component.Settings')
->share('Component.Settings', [$this, 'getSettings'], true);
$container->alias(ComponentData::class, 'Component.Data')
->share('Component.Data', [$this, 'getComponentData'], true);
$container->alias(Dashboard::class, 'Component.Dashboard')
->share('Component.Dashboard', [$this, 'getDashboard'], true);
$container->alias(Placeholder::class, 'Component.Placeholder')
->share('Component.Placeholder', [$this, 'getPlaceholder'], true);
$container->alias(Data::class, 'Component.Data')
->share('Component.Data', [$this, 'getData'], true);
$container->alias(Structure::class, 'Component.Structure')
->share('Component.Structure', [$this, 'getStructure'], true);
$container->alias(Structuresingle::class, 'Component.Structure.Single')
->share('Component.Structure.Single', [$this, 'getStructuresingle'], true);
$container->alias(Structuremultiple::class, 'Component.Structure.Multiple')
->share('Component.Structure.Multiple', [$this, 'getStructuremultiple'], true);
}
/**
@@ -51,27 +71,65 @@ class Component implements ServiceProviderInterface
*
* @param Container $container The DI container.
*
* @return ComponentObject
* @return CompilerComponent
* @since 3.2.0
*/
public function getComponent(Container $container): ComponentObject
public function getComponent(Container $container): CompilerComponent
{
return new ComponentObject(
return new CompilerComponent(
$container->get('Component.Data')
);
}
/**
* Get the Compiler Component (version) Settings
*
* @param Container $container The DI container.
*
* @return Settings
* @since 3.2.0
*/
public function getSettings(Container $container): Settings
{
return new Settings(
$container->get('Config'),
$container->get('Registry'),
$container->get('Event'),
$container->get('Placeholder'),
$container->get('Component'),
$container->get('Utilities.Paths'),
$container->get('Utilities.Dynamicpath'),
$container->get('Utilities.Pathfix')
);
}
/**
* Get the Compiler Component Dynamic Dashboard
*
* @param Container $container The DI container.
*
* @return Dashboard
* @since 3.2.0
*/
public function getDashboard(Container $container): Dashboard
{
return new Dashboard(
$container->get('Registry'),
$container->get('Component')
);
}
/**
* Get the Component Placeholders
*
* @param Container $container The DI container.
*
* @return ComponentPlaceholder
* @return Placeholder
* @since 3.2.0
*/
public function getComponentPlaceholder(Container $container): ComponentPlaceholder
public function getPlaceholder(Container $container): Placeholder
{
return new ComponentPlaceholder(
return new Placeholder(
$container->get('Config')
);
}
@@ -81,12 +139,12 @@ class Component implements ServiceProviderInterface
*
* @param Container $container The DI container.
*
* @return ComponentData
* @return Data
* @since 3.2.0
*/
public function getComponentData(Container $container): ComponentData
public function getData(Container $container): Data
{
return new ComponentData(
return new Data(
$container->get('Config'),
$container->get('Event'),
$container->get('Placeholder'),
@@ -107,6 +165,67 @@ class Component implements ServiceProviderInterface
$container->get('Model.Joomlamodules'),
$container->get('Model.Joomlaplugins')
);
}
}
/**
* Get the Compiler Structure
*
* @param Container $container The DI container.
*
* @return Structure
* @since 3.2.0
*/
public function getStructure(Container $container): Structure
{
return new Structure(
$container->get('Component.Settings'),
$container->get('Utilities.Paths'),
$container->get('Utilities.Folder')
);
}
/**
* Get the Compiler Structure Single
*
* @param Container $container The DI container.
*
* @return Structuresingle
* @since 3.2.0
*/
public function getStructuresingle(Container $container): Structuresingle
{
return new Structuresingle(
$container->get('Config'),
$container->get('Registry'),
$container->get('Component.Settings'),
$container->get('Component'),
$container->get('Content'),
$container->get('Utilities.Counter'),
$container->get('Utilities.Paths'),
$container->get('Utilities.Files')
);
}
/**
* Get the Compiler Structure Multiple
*
* @param Container $container The DI container.
*
* @return Structuremultiple
* @since 3.2.0
*/
public function getStructuremultiple(Container $container): Structuremultiple
{
return new Structuremultiple(
$container->get('Config'),
$container->get('Registry'),
$container->get('Component.Settings'),
$container->get('Component'),
$container->get('Model.Createdate'),
$container->get('Model.Modifieddate'),
$container->get('Utilities.Structure')
);
}
}

View File

@@ -199,7 +199,8 @@ class Customcode implements ServiceProviderInterface
$container->get('Customcode.Gui'),
$container->get('Customcode.Extractor.Paths'),
$container->get('Placeholder.Reverse'),
$container->get('Component.Placeholder')
$container->get('Component.Placeholder'),
$container->get('Utilities.Pathfix')
);
}

View File

@@ -14,8 +14,8 @@ 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;
use VDM\Joomla\Componentbuilder\Compiler\Joomlamodule\Data;
use VDM\Joomla\Componentbuilder\Compiler\Joomlamodule\Structure;
/**
@@ -35,11 +35,11 @@ class Joomlamodule implements ServiceProviderInterface
*/
public function register(Container $container)
{
$container->alias(JoomlaModuleData::class, 'Joomlamodule.Data')
->share('Joomlamodule.Data', [$this, 'getJoomlaModuleData'], true);
$container->alias(Data::class, 'Joomlamodule.Data')
->share('Joomlamodule.Data', [$this, 'getData'], true);
$container->alias(JoomlaModuleBuilder::class, 'Joomlamodule.Builder')
->share('Joomlamodule.Builder', [$this, 'getJoomlaModuleBuilder'], true);
$container->alias(Structure::class, 'Joomlamodule.Structure')
->share('Joomlamodule.Structure', [$this, 'getStructure'], true);
}
/**
@@ -47,12 +47,12 @@ class Joomlamodule implements ServiceProviderInterface
*
* @param Container $container The DI container.
*
* @return JoomlaModuleData
* @return Data
* @since 3.2.0
*/
public function getJoomlaModuleData(Container $container): JoomlaModuleData
public function getData(Container $container): Data
{
return new JoomlaModuleData(
return new Data(
$container->get('Config'),
$container->get('Customcode'),
$container->get('Customcode.Gui'),
@@ -67,16 +67,16 @@ class Joomlamodule implements ServiceProviderInterface
}
/**
* Get the Joomla Module Builder
* Get the Joomla Module Structure Builder
*
* @param Container $container The DI container.
*
* @return JoomlaModuleBuilder
* @return Structure
* @since 3.2.0
*/
public function getJoomlaModuleBuilder(Container $container): JoomlaModuleBuilder
public function getStructure(Container $container): Structure
{
return new JoomlaModuleBuilder(
return new Structure(
$container->get('Joomlamodule.Data'),
$container->get('Component'),
$container->get('Config'),

View File

@@ -14,8 +14,8 @@ 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;
use VDM\Joomla\Componentbuilder\Compiler\Joomlaplugin\Data;
use VDM\Joomla\Componentbuilder\Compiler\Joomlaplugin\Structure;
/**
@@ -35,11 +35,11 @@ class Joomlaplugin implements ServiceProviderInterface
*/
public function register(Container $container)
{
$container->alias(JoomlaPluginData::class, 'Joomlaplugin.Data')
->share('Joomlaplugin.Data', [$this, 'getJoomlaPluginData'], true);
$container->alias(Data::class, 'Joomlaplugin.Data')
->share('Joomlaplugin.Data', [$this, 'getData'], true);
$container->alias(JoomlaPluginBuilder::class, 'Joomlaplugin.Builder')
->share('Joomlaplugin.Builder', [$this, 'getJoomlaPluginBuilder'], true);
$container->alias(Structure::class, 'Joomlaplugin.Structure')
->share('Joomlaplugin.Structure', [$this, 'getStructure'], true);
}
/**
@@ -47,12 +47,12 @@ class Joomlaplugin implements ServiceProviderInterface
*
* @param Container $container The DI container.
*
* @return JoomlaPluginData
* @return Data
* @since 3.2.0
*/
public function getJoomlaPluginData(Container $container): JoomlaPluginData
public function getData(Container $container): Data
{
return new JoomlaPluginData(
return new Data(
$container->get('Config'),
$container->get('Customcode'),
$container->get('Customcode.Gui'),
@@ -65,16 +65,16 @@ class Joomlaplugin implements ServiceProviderInterface
}
/**
* Get the Joomla Plugin Builder
* Get the Joomla Plugin Structure Builder
*
* @param Container $container The DI container.
*
* @return JoomlaPluginBuilder
* @return Structure
* @since 3.2.0
*/
public function getJoomlaPluginBuilder(Container $container): JoomlaPluginBuilder
public function getStructure(Container $container): Structure
{
return new JoomlaPluginBuilder(
return new Structure(
$container->get('Joomlaplugin.Data'),
$container->get('Component'),
$container->get('Config'),

View File

@@ -15,7 +15,7 @@ namespace VDM\Joomla\Componentbuilder\Compiler\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Componentbuilder\Compiler\Library\Data;
use VDM\Joomla\Componentbuilder\Compiler\Library\Builder;
use VDM\Joomla\Componentbuilder\Compiler\Library\Structure;
/**
@@ -38,8 +38,8 @@ class Library implements ServiceProviderInterface
$container->alias(Data::class, 'Library.Data')
->share('Library.Data', [$this, 'getData'], true);
$container->alias(Builder::class, 'Library.Builder')
->share('Library.Builder', [$this, 'getBuilder'], true);
$container->alias(Structure::class, 'Library.Structure')
->share('Library.Structure', [$this, 'getStructure'], true);
}
/**
@@ -63,16 +63,16 @@ class Library implements ServiceProviderInterface
}
/**
* Get the Compiler Library Builder
* Get the Compiler Library Structure Builder
*
* @param Container $container The DI container.
*
* @return Builder
* @return Structure
* @since 3.2.0
*/
public function getBuilder(Container $container): Builder
public function getStructure(Container $container): Structure
{
return new Builder(
return new Structure(
$container->get('Config'),
$container->get('Registry'),
$container->get('Event'),

View File

@@ -50,6 +50,8 @@ use VDM\Joomla\Componentbuilder\Compiler\Model\Sqltweaking;
use VDM\Joomla\Componentbuilder\Compiler\Model\Sqldump;
use VDM\Joomla\Componentbuilder\Compiler\Model\Whmcs;
use VDM\Joomla\Componentbuilder\Compiler\Model\Filesfolders;
use VDM\Joomla\Componentbuilder\Compiler\Model\Modifieddate;
use VDM\Joomla\Componentbuilder\Compiler\Model\Createdate;
/**
@@ -174,6 +176,12 @@ class Model implements ServiceProviderInterface
$container->alias(Filesfolders::class, 'Model.Filesfolders')
->share('Model.Filesfolders', [$this, 'getModelFilesfolders'], true);
$container->alias(Modifieddate::class, 'Model.Modifieddate')
->share('Model.Modifieddate', [$this, 'getModifieddate'], true);
$container->alias(Createdate::class, 'Model.Createdate')
->share('Model.Createdate', [$this, 'getCreatedate'], true);
$container->alias(ServerLoad::class, 'Model.Server.Load')
->share('Model.Server.Load', [$this, 'getServerLoad'], true);
}
@@ -724,6 +732,32 @@ class Model implements ServiceProviderInterface
return new Whmcs();
}
/**
* Get the modified date Model
*
* @param Container $container The DI container.
*
* @return Modifieddate
* @since 3.2.0
*/
public function getModifieddate(Container $container): Modifieddate
{
return new Modifieddate();
}
/**
* Get the create date Model
*
* @param Container $container The DI container.
*
* @return Createdate
* @since 3.2.0
*/
public function getCreatedate(Container $container): Createdate
{
return new Createdate();
}
/**
* Get the files folders Model
*

View File

@@ -17,7 +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;
use VDM\Joomla\Componentbuilder\Compiler\Power\Structure;
/**
@@ -46,8 +46,8 @@ 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);
$container->alias(Structure::class, 'Power.Structure')
->share('Power.Structure', [$this, 'getStructure'], true);
}
/**
@@ -106,16 +106,16 @@ class Power implements ServiceProviderInterface
}
/**
* Get the Compiler Power Builder
* Get the Compiler Power Structure Builder
*
* @param Container $container The DI container.
*
* @return Builder
* @return Structure
* @since 3.2.0
*/
public function getBuilder(Container $container): Builder
public function getStructure(Container $container): Structure
{
return new Builder(
return new Structure(
$container->get('Power'),
$container->get('Config'),
$container->get('Registry'),

View File

@@ -20,6 +20,10 @@ 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;
use VDM\Joomla\Componentbuilder\Utilities\Constantpaths;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Dynamicpath;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Pathfix;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Structure;
/**
@@ -53,6 +57,18 @@ class Utilities implements ServiceProviderInterface
$container->alias(Files::class, 'Utilities.Files')
->share('Utilities.Files', [$this, 'getFiles'], true);
$container->alias(Constantpaths::class, 'Utilities.Constantpaths')
->share('Utilities.Constantpaths', [$this, 'getConstantpaths'], true);
$container->alias(Dynamicpath::class, 'Utilities.Dynamicpath')
->share('Utilities.Dynamicpath', [$this, 'getDynamicpath'], true);
$container->alias(Pathfix::class, 'Utilities.Pathfix')
->share('Utilities.Pathfix', [$this, 'getPathfix'], true);
$container->alias(Structure::class, 'Utilities.Structure')
->share('Utilities.Structure', [$this, 'getStructure'], true);
}
/**
@@ -129,6 +145,67 @@ class Utilities implements ServiceProviderInterface
{
return new Files();
}
/**
* Get the Constant Paths
*
* @param Container $container The DI container.
*
* @return Constantpaths
* @since 3.2.0
*/
public function getConstantpaths(Container $container): Constantpaths
{
return new Constantpaths();
}
/**
* Get the Compiler Dynamic Path
*
* @param Container $container The DI container.
*
* @return Dynamicpath
* @since 3.2.0
*/
public function getDynamicpath(Container $container): Dynamicpath
{
return new Dynamicpath(
$container->get('Placeholder'),
$container->get('Utilities.Constantpaths')
);
}
/**
* Get the Compiler Path Fixer
*
* @param Container $container The DI container.
*
* @return Pathfix
* @since 3.2.0
*/
public function getPathfix(Container $container): Pathfix
{
return new Pathfix();
}
/**
* Get the Compiler Structure Dynamic Builder
*
* @param Container $container The DI container.
*
* @return Structure
* @since 3.2.0
*/
public function getStructure(Container $container): Structure
{
return new Structure(
$container->get('Component.Settings'),
$container->get('Utilities.Paths'),
$container->get('Utilities.Counter'),
$container->get('Utilities.File'),
$container->get('Utilities.Files')
);
}
}