mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-14 07:28:41 +00:00
phpstan fixes
This commit is contained in:
parent
f9e71e5a9e
commit
aaf34cd373
|
|
@ -18,6 +18,9 @@ namespace phpOMS\Algorithm\Clustering;
|
||||||
/**
|
/**
|
||||||
* Point interface.
|
* Point interface.
|
||||||
*
|
*
|
||||||
|
* @property int $group Group
|
||||||
|
* @property string $name Name
|
||||||
|
*
|
||||||
* @package phpOMS\Algorithm\Clustering;
|
* @package phpOMS\Algorithm\Clustering;
|
||||||
* @license OMS License 1.0
|
* @license OMS License 1.0
|
||||||
* @link https://orange-management.org
|
* @link https://orange-management.org
|
||||||
|
|
|
||||||
|
|
@ -813,8 +813,6 @@ class DataMapperAbstract implements DataMapperInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setting relation value (id) for relation (since the relation is not stored in an extra relation table)
|
// Setting relation value (id) for relation (since the relation is not stored in an extra relation table)
|
||||||
/** @var string $table */
|
|
||||||
/** @var array $columns */
|
|
||||||
if (!isset(static::$hasMany[$propertyName]['external'])) {
|
if (!isset(static::$hasMany[$propertyName]['external'])) {
|
||||||
$relProperty = $relReflectionClass->getProperty($mapper::$columns[static::$hasMany[$propertyName]['self']]['internal']);
|
$relProperty = $relReflectionClass->getProperty($mapper::$columns[static::$hasMany[$propertyName]['self']]['internal']);
|
||||||
|
|
||||||
|
|
@ -893,8 +891,6 @@ class DataMapperAbstract implements DataMapperInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setting relation value (id) for relation (since the relation is not stored in an extra relation table)
|
// Setting relation value (id) for relation (since the relation is not stored in an extra relation table)
|
||||||
/** @var string $table */
|
|
||||||
/** @var array $columns */
|
|
||||||
if (static::$hasMany[$propertyName]['table'] === static::$hasMany[$propertyName]['mapper']::$table
|
if (static::$hasMany[$propertyName]['table'] === static::$hasMany[$propertyName]['mapper']::$table
|
||||||
&& isset($mapper::$columns[static::$hasMany[$propertyName]['self']])
|
&& isset($mapper::$columns[static::$hasMany[$propertyName]['self']])
|
||||||
) {
|
) {
|
||||||
|
|
@ -1153,8 +1149,6 @@ class DataMapperAbstract implements DataMapperInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
// create if not existing
|
// create if not existing
|
||||||
/** @var string $table */
|
|
||||||
/** @var array $columns */
|
|
||||||
if (static::$hasMany[$propertyName]['table'] === static::$hasMany[$propertyName]['mapper']::$table
|
if (static::$hasMany[$propertyName]['table'] === static::$hasMany[$propertyName]['mapper']::$table
|
||||||
&& isset($mapper::$columns[static::$hasMany[$propertyName]['self']])
|
&& isset($mapper::$columns[static::$hasMany[$propertyName]['self']])
|
||||||
) {
|
) {
|
||||||
|
|
@ -1235,8 +1229,6 @@ class DataMapperAbstract implements DataMapperInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
// create if not existing
|
// create if not existing
|
||||||
/** @var string $table */
|
|
||||||
/** @var array $columns */
|
|
||||||
if (static::$hasMany[$propertyName]['table'] === static::$hasMany[$propertyName]['mapper']::$table
|
if (static::$hasMany[$propertyName]['table'] === static::$hasMany[$propertyName]['mapper']::$table
|
||||||
&& isset($mapper::$columns[static::$hasMany[$propertyName]['self']])
|
&& isset($mapper::$columns[static::$hasMany[$propertyName]['self']])
|
||||||
) {
|
) {
|
||||||
|
|
@ -1293,7 +1285,6 @@ class DataMapperAbstract implements DataMapperInterface
|
||||||
*/
|
*/
|
||||||
private static function deleteRelationTable(string $propertyName, array $objsIds, $objId) : void
|
private static function deleteRelationTable(string $propertyName, array $objsIds, $objId) : void
|
||||||
{
|
{
|
||||||
/** @var string $table */
|
|
||||||
if (empty($objsIds)
|
if (empty($objsIds)
|
||||||
|| static::$hasMany[$propertyName]['table'] === static::$table
|
|| static::$hasMany[$propertyName]['table'] === static::$table
|
||||||
|| static::$hasMany[$propertyName]['table'] === static::$hasMany[$propertyName]['mapper']::$table
|
|| static::$hasMany[$propertyName]['table'] === static::$hasMany[$propertyName]['mapper']::$table
|
||||||
|
|
@ -2879,7 +2870,7 @@ class DataMapperAbstract implements DataMapperInterface
|
||||||
$query->random(static::$primaryField)
|
$query->random(static::$primaryField)
|
||||||
->limit($amount);
|
->limit($amount);
|
||||||
|
|
||||||
return self::getAllByQuery($query, $relations, $depth, null, $query);
|
return self::getAllByQuery($query, $relations, $depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -3103,7 +3094,6 @@ class DataMapperAbstract implements DataMapperInterface
|
||||||
$query = new Builder(self::$db);
|
$query = new Builder(self::$db);
|
||||||
|
|
||||||
if (self::$relations === RelationType::ALL) {
|
if (self::$relations === RelationType::ALL) {
|
||||||
/** @var string $primaryField */
|
|
||||||
$src = $value['external'] ?? $value['mapper']::$primaryField;
|
$src = $value['external'] ?? $value['mapper']::$primaryField;
|
||||||
|
|
||||||
$query->select($value['table'] . '.' . $src)
|
$query->select($value['table'] . '.' . $src)
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ class Builder extends BuilderAbstract
|
||||||
/**
|
/**
|
||||||
* Group.
|
* Group.
|
||||||
*
|
*
|
||||||
* @var string[]
|
* @var string[]|self[]
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public array $groups = [];
|
public array $groups = [];
|
||||||
|
|
@ -274,6 +274,8 @@ class Builder extends BuilderAbstract
|
||||||
{
|
{
|
||||||
$this->type = QueryType::SELECT;
|
$this->type = QueryType::SELECT;
|
||||||
|
|
||||||
|
/** @var mixed[] $columns */
|
||||||
|
/** @var mixed $column */
|
||||||
foreach ($columns as $column) {
|
foreach ($columns as $column) {
|
||||||
if (\is_string($column) || $column instanceof self) {
|
if (\is_string($column) || $column instanceof self) {
|
||||||
$this->selects[] = $column;
|
$this->selects[] = $column;
|
||||||
|
|
@ -489,7 +491,7 @@ class Builder extends BuilderAbstract
|
||||||
/**
|
/**
|
||||||
* From.
|
* From.
|
||||||
*
|
*
|
||||||
* @param array ...$tables Tables
|
* @param mixed ...$tables Tables
|
||||||
*
|
*
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*
|
*
|
||||||
|
|
@ -497,6 +499,8 @@ class Builder extends BuilderAbstract
|
||||||
*/
|
*/
|
||||||
public function from(...$tables) : self
|
public function from(...$tables) : self
|
||||||
{
|
{
|
||||||
|
/** @var mixed[] $tables */
|
||||||
|
/** @var mixed $table */
|
||||||
foreach ($tables as $key => $table) {
|
foreach ($tables as $key => $table) {
|
||||||
if (\is_string($table) || $table instanceof self) {
|
if (\is_string($table) || $table instanceof self) {
|
||||||
$this->from[] = $table;
|
$this->from[] = $table;
|
||||||
|
|
@ -654,7 +658,7 @@ class Builder extends BuilderAbstract
|
||||||
/**
|
/**
|
||||||
* Group by.
|
* Group by.
|
||||||
*
|
*
|
||||||
* @param array|string ...$columns Grouping result
|
* @param mixed ...$columns Grouping result
|
||||||
*
|
*
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*
|
*
|
||||||
|
|
@ -662,6 +666,8 @@ class Builder extends BuilderAbstract
|
||||||
*/
|
*/
|
||||||
public function groupBy(...$columns) : self
|
public function groupBy(...$columns) : self
|
||||||
{
|
{
|
||||||
|
/** @var mixed[] $columns */
|
||||||
|
/** @var mixed $column */
|
||||||
foreach ($columns as $column) {
|
foreach ($columns as $column) {
|
||||||
if (\is_string($column) || $column instanceof self) {
|
if (\is_string($column) || $column instanceof self) {
|
||||||
$this->groups[] = $column;
|
$this->groups[] = $column;
|
||||||
|
|
@ -998,7 +1004,7 @@ class Builder extends BuilderAbstract
|
||||||
/**
|
/**
|
||||||
* Values to insert.
|
* Values to insert.
|
||||||
*
|
*
|
||||||
* @param array ...$sets Values
|
* @param mixed ...$sets Values
|
||||||
*
|
*
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*
|
*
|
||||||
|
|
@ -1030,7 +1036,7 @@ class Builder extends BuilderAbstract
|
||||||
/**
|
/**
|
||||||
* Update columns.
|
* Update columns.
|
||||||
*
|
*
|
||||||
* @param array ...$tables Column names to update
|
* @param mixed ...$tables Column names to update
|
||||||
*
|
*
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*
|
*
|
||||||
|
|
@ -1046,6 +1052,8 @@ class Builder extends BuilderAbstract
|
||||||
|
|
||||||
$this->type = QueryType::UPDATE;
|
$this->type = QueryType::UPDATE;
|
||||||
|
|
||||||
|
/** @var mixed[] $tables */
|
||||||
|
/** @var mixed $table */
|
||||||
foreach ($tables as $table) {
|
foreach ($tables as $table) {
|
||||||
if (\is_string($table) || $table instanceof self) {
|
if (\is_string($table) || $table instanceof self) {
|
||||||
$this->updates[] = $table;
|
$this->updates[] = $table;
|
||||||
|
|
@ -1100,7 +1108,7 @@ class Builder extends BuilderAbstract
|
||||||
/**
|
/**
|
||||||
* Join.
|
* Join.
|
||||||
*
|
*
|
||||||
* @param mixed $table Join query
|
* @param string|self $table Join query
|
||||||
* @param string $type Join type
|
* @param string $type Join type
|
||||||
* @param null|string $alias Alias name (empty = none)
|
* @param null|string $alias Alias name (empty = none)
|
||||||
*
|
*
|
||||||
|
|
@ -1110,7 +1118,9 @@ class Builder extends BuilderAbstract
|
||||||
*/
|
*/
|
||||||
public function join($table, string $type = JoinType::JOIN, string $alias = null) : self
|
public function join($table, string $type = JoinType::JOIN, string $alias = null) : self
|
||||||
{
|
{
|
||||||
if (!\is_string($table) && !($table instanceof self)) {
|
if ((!\is_string($table) && !($table instanceof self))
|
||||||
|
|| ($alias === null && !\is_string($table))
|
||||||
|
) {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -704,7 +704,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function current()
|
public function current() : int
|
||||||
{
|
{
|
||||||
return $this->offsetGet($this->position);
|
return $this->offsetGet($this->position);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,4 +146,16 @@ abstract class HeaderAbstract
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
abstract public function has(string $key) : bool;
|
abstract public function has(string $key) : bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Push all headers.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @codeCoverageIgnore
|
||||||
|
*/
|
||||||
|
public function push() : void
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ use phpOMS\Views\View;
|
||||||
/**
|
/**
|
||||||
* Response class.
|
* Response class.
|
||||||
*
|
*
|
||||||
|
* @property \phpOMS\Message\Http\HttpHeader $header Http header
|
||||||
|
*
|
||||||
* @package phpOMS\Message\Http
|
* @package phpOMS\Message\Http
|
||||||
* @license OMS License 1.0
|
* @license OMS License 1.0
|
||||||
* @link https://orange-management.org
|
* @link https://orange-management.org
|
||||||
|
|
|
||||||
|
|
@ -198,6 +198,7 @@ abstract class InstallerAbstract
|
||||||
{
|
{
|
||||||
$directories = new Directory(\dirname($info->getPath()) . '/Admin/Routes');
|
$directories = new Directory(\dirname($info->getPath()) . '/Admin/Routes');
|
||||||
|
|
||||||
|
/** @var Directory|File $child */
|
||||||
foreach ($directories as $child) {
|
foreach ($directories as $child) {
|
||||||
if ($child instanceof Directory) {
|
if ($child instanceof Directory) {
|
||||||
foreach ($child as $file) {
|
foreach ($child as $file) {
|
||||||
|
|
@ -277,6 +278,7 @@ abstract class InstallerAbstract
|
||||||
{
|
{
|
||||||
$directories = new Directory(\dirname($info->getPath()) . '/Admin/Hooks');
|
$directories = new Directory(\dirname($info->getPath()) . '/Admin/Hooks');
|
||||||
|
|
||||||
|
/** @var Directory|File $child */
|
||||||
foreach ($directories as $child) {
|
foreach ($directories as $child) {
|
||||||
if ($child instanceof Directory) {
|
if ($child instanceof Directory) {
|
||||||
foreach ($child as $file) {
|
foreach ($child as $file) {
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ final class ModuleManager
|
||||||
/**
|
/**
|
||||||
* All modules in the module directory.
|
* All modules in the module directory.
|
||||||
*
|
*
|
||||||
* @var array<string, array>
|
* @var array<string, ModuleInfo>
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private array $all = [];
|
private array $all = [];
|
||||||
|
|
@ -252,7 +252,7 @@ final class ModuleManager
|
||||||
/**
|
/**
|
||||||
* Get all modules in the module directory.
|
* Get all modules in the module directory.
|
||||||
*
|
*
|
||||||
* @return array<string, array>
|
* @return array<string, ModuleInfo>
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
@ -268,10 +268,10 @@ final class ModuleManager
|
||||||
|
|
||||||
$c = $files === false ? 0 : \count($files);
|
$c = $files === false ? 0 : \count($files);
|
||||||
for ($i = 0; $i < $c; ++$i) {
|
for ($i = 0; $i < $c; ++$i) {
|
||||||
$module = $this->loadInfo($files[$i]);
|
$info = $this->loadInfo($files[$i]);
|
||||||
|
|
||||||
if ($module !== null) {
|
if ($info !== null) {
|
||||||
$this->all[$files[$i]] = $module;
|
$this->all[$files[$i]] = $info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -311,7 +311,11 @@ final class ModuleManager
|
||||||
$installed = $sth->fetchAll(\PDO::FETCH_COLUMN);
|
$installed = $sth->fetchAll(\PDO::FETCH_COLUMN);
|
||||||
|
|
||||||
foreach ($installed as $module) {
|
foreach ($installed as $module) {
|
||||||
$this->installed[$module] = $this->loadInfo($module);
|
$info = $this->loadInfo($module);
|
||||||
|
|
||||||
|
if ($info !== null) {
|
||||||
|
$this->installed[$module] = $info;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -361,6 +365,10 @@ final class ModuleManager
|
||||||
try {
|
try {
|
||||||
$info = $this->loadInfo($module);
|
$info = $this->loadInfo($module);
|
||||||
|
|
||||||
|
if ($info === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$this->deactivateModule($info);
|
$this->deactivateModule($info);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -412,6 +420,10 @@ final class ModuleManager
|
||||||
try {
|
try {
|
||||||
$info = $this->loadInfo($module);
|
$info = $this->loadInfo($module);
|
||||||
|
|
||||||
|
if ($info === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$this->activateModule($info);
|
$this->activateModule($info);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -457,7 +469,11 @@ final class ModuleManager
|
||||||
*/
|
*/
|
||||||
public function reInit(string $module, ApplicationInfo $appInfo = null) : void
|
public function reInit(string $module, ApplicationInfo $appInfo = null) : void
|
||||||
{
|
{
|
||||||
$info = $this->loadInfo($module);
|
$info = $this->loadInfo($module);
|
||||||
|
if ($info === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$class = '\\Modules\\' . $info->getDirectory() . '\\Admin\\Installer';
|
$class = '\\Modules\\' . $info->getDirectory() . '\\Admin\\Installer';
|
||||||
|
|
||||||
if (!Autoloader::exists($class)) {
|
if (!Autoloader::exists($class)) {
|
||||||
|
|
@ -491,6 +507,9 @@ final class ModuleManager
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$info = $this->loadInfo($module);
|
$info = $this->loadInfo($module);
|
||||||
|
if ($info === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$this->installed[$module] = $info;
|
$this->installed[$module] = $info;
|
||||||
$this->installDependencies($info->getDependencies());
|
$this->installDependencies($info->getDependencies());
|
||||||
|
|
@ -541,6 +560,9 @@ final class ModuleManager
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$info = $this->loadInfo($module);
|
$info = $this->loadInfo($module);
|
||||||
|
if ($info === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$this->installed[$module] = $info;
|
$this->installed[$module] = $info;
|
||||||
// uninstall dependencies if not used by others
|
// uninstall dependencies if not used by others
|
||||||
|
|
|
||||||
|
|
@ -32,16 +32,8 @@ use phpOMS\Utils\StringUtils;
|
||||||
* @link https://orange-management.org
|
* @link https://orange-management.org
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
class Directory extends FileAbstract implements DirectoryInterface, FtpContainerInterface
|
class Directory extends FileAbstract implements DirectoryInterface
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Directory nodes (files and directories).
|
|
||||||
*
|
|
||||||
* @var FileAbstract[]
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private array $nodes = [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter for directory listing
|
* Filter for directory listing
|
||||||
*
|
*
|
||||||
|
|
@ -50,6 +42,14 @@ class Directory extends FileAbstract implements DirectoryInterface, FtpContainer
|
||||||
*/
|
*/
|
||||||
private string $filter = '*';
|
private string $filter = '*';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Directory nodes (files and directories).
|
||||||
|
*
|
||||||
|
* @var array<string, ContainerInterface>
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
private array $nodes = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create ftp connection.
|
* Create ftp connection.
|
||||||
*
|
*
|
||||||
|
|
@ -385,6 +385,7 @@ class Directory extends FileAbstract implements DirectoryInterface, FtpContainer
|
||||||
$data[$names[$key]] = $e;
|
$data[$names[$key]] = $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var array<string, array{permission:int, number:string, user:string, group:string, size:string, month:string, day:string, time:string, type:string}> */
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -499,7 +500,11 @@ class Directory extends FileAbstract implements DirectoryInterface, FtpContainer
|
||||||
if (\is_dir($item)) {
|
if (\is_dir($item)) {
|
||||||
self::put($con, $item, $to . '/' . self::name($item));
|
self::put($con, $item, $to . '/' . self::name($item));
|
||||||
} else {
|
} else {
|
||||||
File::put($con, $to . '/' . self::name($item), \file_get_contents($item));
|
$content = \file_get_contents($item);
|
||||||
|
|
||||||
|
if ($content !== false) {
|
||||||
|
File::put($con, $to . '/' . self::name($item), $content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -682,7 +687,7 @@ class Directory extends FileAbstract implements DirectoryInterface, FtpContainer
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function key()
|
public function key() : ?string
|
||||||
{
|
{
|
||||||
return \key($this->nodes);
|
return \key($this->nodes);
|
||||||
}
|
}
|
||||||
|
|
@ -690,7 +695,7 @@ class Directory extends FileAbstract implements DirectoryInterface, FtpContainer
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function next()
|
public function next() : FileAbstract
|
||||||
{
|
{
|
||||||
$next = \next($this->nodes);
|
$next = \next($this->nodes);
|
||||||
|
|
||||||
|
|
@ -704,7 +709,7 @@ class Directory extends FileAbstract implements DirectoryInterface, FtpContainer
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function valid()
|
public function valid() : bool
|
||||||
{
|
{
|
||||||
$key = \key($this->nodes);
|
$key = \key($this->nodes);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\System\File\Ftp;
|
namespace phpOMS\System\File\Ftp;
|
||||||
|
|
||||||
use phpOMS\System\File\ContainerInterface;
|
|
||||||
use phpOMS\Uri\HttpUri;
|
use phpOMS\Uri\HttpUri;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -27,7 +26,7 @@ use phpOMS\Uri\HttpUri;
|
||||||
* @link https://orange-management.org
|
* @link https://orange-management.org
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
abstract class FileAbstract implements ContainerInterface
|
abstract class FileAbstract implements FtpContainerInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Ftp connection
|
* Ftp connection
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\System\File\Ftp;
|
namespace phpOMS\System\File\Ftp;
|
||||||
|
|
||||||
|
use phpOMS\System\File\ContainerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filesystem class.
|
* Filesystem class.
|
||||||
*
|
*
|
||||||
|
|
@ -24,7 +26,7 @@ namespace phpOMS\System\File\Ftp;
|
||||||
* @link https://orange-management.org
|
* @link https://orange-management.org
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
interface FtpContainerInterface
|
interface FtpContainerInterface extends ContainerInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the datetime when the resource got created.
|
* Get the datetime when the resource got created.
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ use phpOMS\Utils\StringUtils;
|
||||||
* @link https://orange-management.org
|
* @link https://orange-management.org
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
final class Directory extends FileAbstract implements DirectoryInterface, LocalContainerInterface
|
final class Directory extends FileAbstract implements DirectoryInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Directory list filter.
|
* Directory list filter.
|
||||||
|
|
@ -42,7 +42,7 @@ final class Directory extends FileAbstract implements DirectoryInterface, LocalC
|
||||||
/**
|
/**
|
||||||
* Directory nodes (files and directories).
|
* Directory nodes (files and directories).
|
||||||
*
|
*
|
||||||
* @var ContainerInterface[]
|
* @var array<string, ContainerInterface>
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private array $nodes = [];
|
private array $nodes = [];
|
||||||
|
|
@ -163,7 +163,12 @@ final class Directory extends FileAbstract implements DirectoryInterface, LocalC
|
||||||
|
|
||||||
parent::index();
|
parent::index();
|
||||||
|
|
||||||
foreach (\glob($this->path . \DIRECTORY_SEPARATOR . $this->filter) as $filename) {
|
$files = \glob($this->path . \DIRECTORY_SEPARATOR . $this->filter);
|
||||||
|
if ($files === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($files as $filename) {
|
||||||
if (!StringUtils::endsWith(\trim($filename), '.')) {
|
if (!StringUtils::endsWith(\trim($filename), '.')) {
|
||||||
$file = \is_dir($filename) ? new self($filename, '*', false) : new File($filename);
|
$file = \is_dir($filename) ? new self($filename, '*', false) : new File($filename);
|
||||||
|
|
||||||
|
|
@ -493,7 +498,7 @@ final class Directory extends FileAbstract implements DirectoryInterface, LocalC
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function current()
|
public function current() : self
|
||||||
{
|
{
|
||||||
$current = \current($this->nodes);
|
$current = \current($this->nodes);
|
||||||
|
|
||||||
|
|
@ -507,7 +512,7 @@ final class Directory extends FileAbstract implements DirectoryInterface, LocalC
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function key()
|
public function key() : ?string
|
||||||
{
|
{
|
||||||
return \key($this->nodes);
|
return \key($this->nodes);
|
||||||
}
|
}
|
||||||
|
|
@ -515,7 +520,7 @@ final class Directory extends FileAbstract implements DirectoryInterface, LocalC
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function next()
|
public function next() : FileAbstract
|
||||||
{
|
{
|
||||||
$next = \next($this->nodes);
|
$next = \next($this->nodes);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ use phpOMS\System\File\PathException;
|
||||||
* @link https://orange-management.org
|
* @link https://orange-management.org
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
final class File extends FileAbstract implements FileInterface, LocalContainerInterface
|
final class File extends FileAbstract implements FileInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\System\File\Local;
|
namespace phpOMS\System\File\Local;
|
||||||
|
|
||||||
use phpOMS\System\File\ContainerInterface;
|
use phpOMS\System\File\PathException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filesystem class.
|
* Filesystem class.
|
||||||
|
|
@ -26,7 +26,7 @@ use phpOMS\System\File\ContainerInterface;
|
||||||
* @link https://orange-management.org
|
* @link https://orange-management.org
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
abstract class FileAbstract implements ContainerInterface
|
abstract class FileAbstract implements LocalContainerInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Path.
|
* Path.
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\System\File\Local;
|
namespace phpOMS\System\File\Local;
|
||||||
|
|
||||||
|
use phpOMS\System\File\ContainerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filesystem class.
|
* Filesystem class.
|
||||||
*
|
*
|
||||||
|
|
@ -24,7 +26,7 @@ namespace phpOMS\System\File\Local;
|
||||||
* @link https://orange-management.org
|
* @link https://orange-management.org
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
interface LocalContainerInterface
|
interface LocalContainerInterface extends ContainerInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the datetime when the resource got created.
|
* Get the datetime when the resource got created.
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,13 @@ namespace phpOMS\Uri;
|
||||||
/**
|
/**
|
||||||
* Uri interface.
|
* Uri interface.
|
||||||
*
|
*
|
||||||
|
* @property string $scheme Scheme
|
||||||
|
* @property string $host Host
|
||||||
|
* @property int $port Port
|
||||||
|
* @property string $fragment Fragment
|
||||||
|
* @property string $user User
|
||||||
|
* @property string $pass Password
|
||||||
|
*
|
||||||
* @package phpOMS\Uri
|
* @package phpOMS\Uri
|
||||||
* @license OMS License 1.0
|
* @license OMS License 1.0
|
||||||
* @link https://orange-management.org
|
* @link https://orange-management.org
|
||||||
|
|
|
||||||
|
|
@ -429,7 +429,7 @@ class Repository
|
||||||
*/
|
*/
|
||||||
public function createBranch(Branch $branch, bool $force = false) : string
|
public function createBranch(Branch $branch, bool $force = false) : string
|
||||||
{
|
{
|
||||||
return \implode("\n", $this->run('branch ' . ($force ? '-D' : '-d') . ' ' . $branch->getName()));
|
return \implode("\n", $this->run('branch ' . ($force ? '-D' : '-d') . ' ' . $branch->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -497,7 +497,7 @@ class Repository
|
||||||
*/
|
*/
|
||||||
public function checkout(Branch $branch) : string
|
public function checkout(Branch $branch) : string
|
||||||
{
|
{
|
||||||
$result = \implode("\n", $this->run('checkout ' . $branch->getName()));
|
$result = \implode("\n", $this->run('checkout ' . $branch->name));
|
||||||
$this->branch = $branch;
|
$this->branch = $branch;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|
@ -514,7 +514,7 @@ class Repository
|
||||||
*/
|
*/
|
||||||
public function merge(Branch $branch) : string
|
public function merge(Branch $branch) : string
|
||||||
{
|
{
|
||||||
return \implode("\n", $this->run('merge ' . $branch->getName() . ' --no-ff'));
|
return \implode("\n", $this->run('merge ' . $branch->name . ' --no-ff'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -579,7 +579,7 @@ class Repository
|
||||||
{
|
{
|
||||||
$remote = \escapeshellarg($remote);
|
$remote = \escapeshellarg($remote);
|
||||||
|
|
||||||
return \implode("\n", $this->run('push --tags ' . $remote . ' ' . $branch->getName()));
|
return \implode("\n", $this->run('push --tags ' . $remote . ' ' . $branch->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -596,7 +596,7 @@ class Repository
|
||||||
{
|
{
|
||||||
$remote = \escapeshellarg($remote);
|
$remote = \escapeshellarg($remote);
|
||||||
|
|
||||||
return \implode("\n", $this->run('pull ' . $remote . ' ' . $branch->getName()));
|
return \implode("\n", $this->run('pull ' . $remote . ' ' . $branch->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -711,7 +711,7 @@ class Repository
|
||||||
|
|
||||||
$author = \substr($line, \strlen($matches[0]) + 1);
|
$author = \substr($line, \strlen($matches[0]) + 1);
|
||||||
$contributor = new Author($author === false ? '' : $author);
|
$contributor = new Author($author === false ? '' : $author);
|
||||||
$contributor->setCommitCount($this->getCommitsCount($start, $end)[$contributor->getName()]);
|
$contributor->setCommitCount($this->getCommitsCount($start, $end)[$contributor->name]);
|
||||||
|
|
||||||
$addremove = $this->getAdditionsRemovalsByContributor($contributor, $start, $end);
|
$addremove = $this->getAdditionsRemovalsByContributor($contributor, $start, $end);
|
||||||
$contributor->setAdditionCount($addremove['added']);
|
$contributor->setAdditionCount($addremove['added']);
|
||||||
|
|
@ -781,7 +781,7 @@ class Repository
|
||||||
|
|
||||||
$addremove = ['added' => 0, 'removed' => 0];
|
$addremove = ['added' => 0, 'removed' => 0];
|
||||||
$lines = $this->run(
|
$lines = $this->run(
|
||||||
'log --author=' . \escapeshellarg($author->getName())
|
'log --author=' . \escapeshellarg($author->name)
|
||||||
. ' --since="' . $start->format('Y-m-d')
|
. ' --since="' . $start->format('Y-m-d')
|
||||||
. '" --before="' . $end->format('Y-m-d')
|
. '" --before="' . $end->format('Y-m-d')
|
||||||
. '" --pretty=tformat: --numstat'
|
. '" --pretty=tformat: --numstat'
|
||||||
|
|
@ -833,7 +833,7 @@ class Repository
|
||||||
if ($author === null) {
|
if ($author === null) {
|
||||||
$author = '';
|
$author = '';
|
||||||
} else {
|
} else {
|
||||||
$author = ' --author=' . \escapeshellarg($author->getName()) . '';
|
$author = ' --author=' . \escapeshellarg($author->name) . '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$lines = $this->run(
|
$lines = $this->run(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user