Moved some class around for better structure in the jcb_powers of JCB. Fixed small issue with JCB package export.

This commit is contained in:
2022-10-23 23:18:02 +02:00
parent d4843d6696
commit 869a1879cb
18 changed files with 136 additions and 81 deletions

View File

@ -20,11 +20,11 @@ use VDM\Joomla\Utilities\String\ClassfunctionHelper;
/**
* Registry
* Config
*
* @since 3.2.0
*/
abstract class Registry extends JoomlaRegistry
abstract class BaseConfig extends JoomlaRegistry
{
/**
* Hold a JInput object for easier access to the input variables.

View File

@ -0,0 +1,49 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd 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\Abstraction;
use Joomla\Registry\Registry as JoomlaRegistry;
/**
* Registry
*
* So we have full control over this class
*
* @since 3.2.0
*/
abstract class BaseRegistry extends JoomlaRegistry implements \JsonSerializable, \ArrayAccess, \IteratorAggregate, \Countable
{
/**
* Method to iterate over any part of the registry
*
* @param string $path Registry path (e.g. joomla.content.showauthor)
*
* @return \ArrayIterator This object represented as an ArrayIterator.
*
* @since 3.4.0
*/
public function _($path)
{
$data = $this->extract($path);
if ($data === null)
{
return null;
}
return $data->getIterator();
}
}

View File

@ -14,7 +14,7 @@ namespace VDM\Joomla\Componentbuilder\Compiler;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Abstraction\Registry;
use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig;
/**
@ -22,7 +22,7 @@ use VDM\Joomla\Componentbuilder\Abstraction\Registry;
*
* @since 3.2.0
*/
class Config extends Registry
class Config extends BaseConfig
{
/**
* get posted component id

View File

@ -13,6 +13,16 @@ namespace VDM\Joomla\Componentbuilder\Compiler;
use Joomla\DI\Container;
use VDM\Joomla\Componentbuilder\Compiler\Service\Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Service\Event;
use VDM\Joomla\Componentbuilder\Compiler\Service\History;
use VDM\Joomla\Componentbuilder\Compiler\Service\Language;
use VDM\Joomla\Componentbuilder\Compiler\Service\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Service\Customcode;
use VDM\Joomla\Componentbuilder\Compiler\Service\Power;
use VDM\Joomla\Componentbuilder\Compiler\Service\Component;
use VDM\Joomla\Componentbuilder\Compiler\Service\Extension;
use VDM\Joomla\Componentbuilder\Compiler\Service\Field;
/**
@ -43,7 +53,7 @@ abstract class Factory
*
* @param string $key The container class key
*
* @return Mixed
* @return mixed
* @since 3.2.0
*/
public static function _($key)
@ -56,7 +66,7 @@ abstract class Factory
*
* @param string $key The container class key
*
* @return Mixed
* @return mixed
* @since 3.2.0
*/
public static function _J($key)
@ -94,20 +104,19 @@ abstract class Factory
protected static function createContainer(): Container
{
$container = (new Container())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Compiler\Service\Compiler())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Compiler\Service\Event())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Compiler\Service\History())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Compiler\Service\Language())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Compiler\Service\Placeholder())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Compiler\Service\Customcode())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Compiler\Service\Power())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Compiler\Service\Component())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Compiler\Service\Extension())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Compiler\Service\Field());
->registerServiceProvider(new Compiler())
->registerServiceProvider(new Event())
->registerServiceProvider(new History())
->registerServiceProvider(new Language())
->registerServiceProvider(new Placeholder())
->registerServiceProvider(new Customcode())
->registerServiceProvider(new Power())
->registerServiceProvider(new Component())
->registerServiceProvider(new Extension())
->registerServiceProvider(new Field());
return $container;
}
}

View File

@ -12,18 +12,16 @@
namespace VDM\Joomla\Componentbuilder\Compiler;
use Joomla\Registry\Registry as JoomlaRegistry;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
use VDM\Joomla\Componentbuilder\Abstraction\BaseRegistry;
/**
* Compiler Registry
*
* So we have full control over this class
*
* @since 3.2.0
*/
class Registry extends JoomlaRegistry implements \JsonSerializable, \ArrayAccess, \IteratorAggregate, \Countable
class Registry extends BaseRegistry
{
/**
* Default indentation value
@ -33,27 +31,6 @@ class Registry extends JoomlaRegistry implements \JsonSerializable, \ArrayAccess
*/
protected $indent = 2;
/**
* Method to iterate over any part of the registry
*
* @param string $path Registry path (e.g. joomla.content.showauthor)
*
* @return \ArrayIterator This object represented as an ArrayIterator.
*
* @since 3.4.0
*/
public function _($path)
{
$data = $this->extract($path);
if ($data === null)
{
return null;
}
return $data->getIterator();
}
/**
* Method to export a set of values to a PHP array
*

View File

@ -12,7 +12,7 @@
namespace VDM\Joomla\Componentbuilder\Search;
use VDM\Joomla\Componentbuilder\Abstraction\Registry;
use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig;
/**
@ -20,7 +20,7 @@ use VDM\Joomla\Componentbuilder\Abstraction\Registry;
*
* @since 3.2.0
*/
class Config extends Registry
class Config extends BaseConfig
{
/**
* get posted search value

View File

@ -13,6 +13,10 @@ namespace VDM\Joomla\Componentbuilder\Search;
use Joomla\DI\Container;
use VDM\Joomla\Componentbuilder\Search\Service\Search;
use VDM\Joomla\Componentbuilder\Search\Service\Model;
use VDM\Joomla\Componentbuilder\Search\Service\Database;
use VDM\Joomla\Componentbuilder\Search\Service\Agent;
/**
@ -68,10 +72,10 @@ abstract class Factory
protected static function createContainer(): Container
{
$container = (new Container())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Search\Service\Search())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Search\Service\Model())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Search\Service\Database())
->registerServiceProvider(new \VDM\Joomla\Componentbuilder\Search\Service\Agent());
->registerServiceProvider(new Search())
->registerServiceProvider(new Model())
->registerServiceProvider(new Database())
->registerServiceProvider(new Agent());
return $container;
}

View File

@ -26,17 +26,17 @@ abstract class GetHelper
/**
* Get a Variable
*
* @param string $table The table from which to get the variable
* @param string $where The value where
* @param string $whereString The target/field string where/name
* @param string $what The return field
* @param string $operator The operator between $whereString/field and $where/value
* @param string $main The component in which the table is found
* @param string|null $table The table from which to get the variable
* @param mixed $where The value where
* @param string $whereString The target/field string where/name
* @param string $what The return field
* @param string $operator The operator between $whereString/field and $where/value
* @param string $main The component in which the table is found
*
* @return mixed string/int/float
* @since 3.0.9
*/
public static function var(string $table, ?string $where = null,
public static function var(?string $table = null, $where = null,
string $whereString = 'user', string $what = 'id',
string $operator = '=', ?string $main = null)
{
@ -93,18 +93,18 @@ abstract class GetHelper
/**
* Get array of variables
*
* @param string $table The table from which to get the variables
* @param string $where The value where
* @param string $whereString The target/field string where/name
* @param string $what The return field
* @param string $operator The operator between $whereString/field and $where/value
* @param string $main The component in which the table is found
* @param bool $unique The switch to return a unique array
* @param string|null $table The table from which to get the variables
* @param mixed $where The value where
* @param string $whereString The target/field string where/name
* @param string $what The return field
* @param string $operator The operator between $whereString/field and $where/value
* @param string $main The component in which the table is found
* @param bool $unique The switch to return a unique array
*
* @return array|null
* @since 3.0.9
*/
public static function vars(string $table, ?string $where = null,
public static function vars(?string $table = null, $where = null,
string $whereString = 'user', string $what = 'id', string $operator = 'IN',
?string $main = null, bool $unique = true): ?array
{