Release of v5.0.1-alpha5

Add repositories for better integration with gitea. Refactored the Data classes. Add new Data classes.
This commit is contained in:
2024-06-21 03:25:28 +02:00
parent fc6b04cb5c
commit c51ef999a9
120 changed files with 8945 additions and 3699 deletions

View File

@@ -189,16 +189,22 @@ abstract class Grep implements GrepInterface
{
foreach ($this->paths as $n => &$path)
{
if (isset($path->owner) && strlen($path->owner) > 1 &&
isset($path->repo) && strlen($path->repo) > 1)
if (isset($path->organisation) && strlen($path->organisation) > 1 &&
isset($path->repository) && strlen($path->repository) > 1)
{
// build the path
$path->path = trim($path->owner) . '/' . trim($path->repo);
$path->path = trim($path->organisation) . '/' . trim($path->repository);
// update the branch
if ($path->branch === 'default' || empty($path->branch))
if ($path->read_branch === 'default' || empty($path->read_branch))
{
$path->branch = null;
$path->read_branch = null;
}
// only update the write branch if set
if (isset($path->write_branch) && ($path->write_branch === 'default' || empty($path->write_branch)))
{
$path->write_branch = null;
}
// set local path

View File

@@ -15,6 +15,7 @@ namespace VDM\Joomla\Abstraction;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Interfaces\Tableinterface as Table;
use VDM\Joomla\Interfaces\ModelInterface;
/**
@@ -22,7 +23,7 @@ use VDM\Joomla\Interfaces\Tableinterface as Table;
*
* @since 3.2.0
*/
abstract class Model
abstract class Model implements ModelInterface
{
/**
* Last ID
@@ -40,16 +41,57 @@ abstract class Model
*/
protected Table $table;
/**
* Table Name
*
* @var string
* @since 3.2.0
*/
protected string $tableName;
/**
* The switch to control the behaviour of empty values
*
* @var bool
* @since 3.2.2
*/
protected bool $allowEmpty = true;
/**
* Constructor
*
* @param Table $table The search table object.
* @param Table $table The search table object.
* @param string|null $tableName The table
* @param bool|null $allowEmpty The switch to control the behaviour of empty values (default true)
*
* @since 3.2.0
*/
public function __construct(Table $table)
public function __construct(Table $table, ?string $tableName = null, bool $allowEmpty = null)
{
$this->table = $table;
if ($tableName !== null)
{
$this->setTable($tableName);
}
if ($allowEmpty !== null)
{
$this->setAllowEmpty($allowEmpty);
}
}
/**
* Set the current active table
*
* @param string $table The table that should be active
*
* @return self
* @since 3.2.2
*/
public function table(string $table): self
{
$this->setTable($table);
return $this;
}
/**
@@ -309,6 +351,54 @@ abstract class Model
return null;
}
/**
* Set the current active table
*
* @param string $tableName The table name
*
* @return void
* @since 3.2.2
*/
public function setTable(string $tableName): void
{
$this->tableName = $tableName;
}
/**
* Set the switch to control the behaviour of empty values
*
* @param bool $allowEmpty The switch
*
* @return void
* @since 3.2.2
*/
public function setAllowEmpty(bool $allowEmpty): void
{
$this->allowEmpty = $allowEmpty;
}
/**
* Get the current active table
*
* @return string
* @since 3.2.0
*/
protected function getTable(): string
{
return $this->tableName;
}
/**
* Get the switch to control the behaviour of empty values
*
* @return bool
* @since 3.2.2
*/
protected function getAllowEmpty(): bool
{
return $this->allowEmpty;
}
/**
* Get the current active table's fields (including defaults)
*
@@ -345,14 +435,6 @@ abstract class Model
* @return bool
* @since 3.2.0
*/
abstract protected function validateAfter(&$value, ?string $field = null, ?string $table = null): bool;
/**
* Get the current active table
*
* @return string
* @since 3.2.0
*/
abstract protected function getTable(): string;
abstract protected function validateAfter(&$value, ?string $field = null, ?string $table = null): bool;
}