cs
This commit is contained in:
@@ -29,44 +29,26 @@
|
||||
|
||||
namespace Espo\Core\Utils\Acl;
|
||||
|
||||
use Espo\Entities\Portal;
|
||||
use Espo\Entities\User;
|
||||
use Espo\ORM\EntityManager;
|
||||
use Espo\Core\AclManager;
|
||||
use Espo\Core\Portal\AclManagerContainer as PortalAclManagerContainer;
|
||||
use Espo\Core\Exceptions\Error;
|
||||
|
||||
use Espo\Core\ApplicationState;
|
||||
use RuntimeException;
|
||||
|
||||
class UserAclManagerProvider
|
||||
{
|
||||
private EntityManager $entityManager;
|
||||
|
||||
private AclManager $aclManager;
|
||||
|
||||
private PortalAclManagerContainer $portalAclManagerContainer;
|
||||
|
||||
private ApplicationState $applicationState;
|
||||
|
||||
/**
|
||||
* @var array<string,AclManager>
|
||||
*/
|
||||
/** @var array<string, AclManager> */
|
||||
private $map = [];
|
||||
|
||||
public function __construct(
|
||||
EntityManager $entityManager,
|
||||
AclManager $aclManager,
|
||||
PortalAclManagerContainer $portalAclManagerContainer,
|
||||
ApplicationState $applicationState
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
$this->aclManager = $aclManager;
|
||||
$this->portalAclManagerContainer = $portalAclManagerContainer;
|
||||
$this->applicationState = $applicationState;
|
||||
}
|
||||
private EntityManager $entityManager,
|
||||
private AclManager $aclManager,
|
||||
private PortalAclManagerContainer $portalAclManagerContainer,
|
||||
private ApplicationState $applicationState
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @throws Error
|
||||
*/
|
||||
public function get(User $user): AclManager
|
||||
{
|
||||
$key = $user->hasId() ? $user->getId() : spl_object_hash($user);
|
||||
@@ -83,14 +65,14 @@ class UserAclManagerProvider
|
||||
$aclManager = $this->aclManager;
|
||||
|
||||
if ($user->isPortal() && !$this->applicationState->isPortal()) {
|
||||
/** @var ?\Espo\Entities\Portal $portal */
|
||||
/** @var ?Portal $portal */
|
||||
$portal = $this->entityManager
|
||||
->getRDBRepository(User::ENTITY_TYPE)
|
||||
->getRelation($user, 'portals')
|
||||
->findOne();
|
||||
|
||||
if (!$portal) {
|
||||
throw new Error("No portal for portal user '" . $user->getId() . "'.");
|
||||
throw new RuntimeException("No portal for portal user '" . $user->getId() . "'.");
|
||||
}
|
||||
|
||||
$aclManager = $this->portalAclManagerContainer->get($portal);
|
||||
|
||||
@@ -33,15 +33,10 @@ use Espo\Core\Utils\File\Manager as FileManager;
|
||||
|
||||
class Loader
|
||||
{
|
||||
private NamespaceLoader $namespaceLoader;
|
||||
|
||||
private FileManager $fileManager;
|
||||
|
||||
public function __construct(NamespaceLoader $namespaceLoader, FileManager $fileManager)
|
||||
{
|
||||
$this->namespaceLoader = $namespaceLoader;
|
||||
$this->fileManager = $fileManager;
|
||||
}
|
||||
public function __construct(
|
||||
private NamespaceLoader $namespaceLoader,
|
||||
private FileManager $fileManager
|
||||
) {}
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -29,13 +29,11 @@
|
||||
|
||||
namespace Espo\Core\Utils\Autoload;
|
||||
|
||||
use Espo\Core\{
|
||||
Utils\Util,
|
||||
Utils\Config,
|
||||
Utils\DataCache,
|
||||
Utils\File\Manager as FileManager,
|
||||
Utils\Log,
|
||||
};
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Core\Utils\DataCache;
|
||||
use Espo\Core\Utils\File\Manager as FileManager;
|
||||
use Espo\Core\Utils\Log;
|
||||
use Espo\Core\Utils\Util;
|
||||
|
||||
use Composer\Autoload\ClassLoader;
|
||||
|
||||
@@ -51,49 +49,30 @@ class NamespaceLoader
|
||||
* }
|
||||
*/
|
||||
private $namespaces = null;
|
||||
|
||||
/**
|
||||
* @var ?array<string, mixed>
|
||||
*/
|
||||
/** @var ?array<string, mixed> */
|
||||
private $vendorNamespaces = null;
|
||||
|
||||
private string $autoloadFilePath = 'vendor/autoload.php';
|
||||
|
||||
/**
|
||||
* @var array<'psr-4'|'psr-0'|'classmap', string>
|
||||
*/
|
||||
/** @var array<'psr-4'|'psr-0'|'classmap', string> */
|
||||
private $namespacesPaths = [
|
||||
'psr-4' => 'vendor/composer/autoload_psr4.php',
|
||||
'psr-0' => 'vendor/composer/autoload_namespaces.php',
|
||||
'classmap' => 'vendor/composer/autoload_classmap.php',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array<'psr-4'|'psr-0', string>
|
||||
*/
|
||||
/** @var array<'psr-4'|'psr-0', string> */
|
||||
private $methodNameMap = [
|
||||
'psr-4' => 'addPsr4',
|
||||
'psr-0' => 'add',
|
||||
];
|
||||
|
||||
private string $cacheKey = 'autoloadVendorNamespaces';
|
||||
|
||||
private ClassLoader $classLoader;
|
||||
|
||||
private Config $config;
|
||||
|
||||
private DataCache $dataCache;
|
||||
|
||||
private FileManager $fileManager;
|
||||
|
||||
private Log $log;
|
||||
|
||||
public function __construct(Config $config, DataCache $dataCache, FileManager $fileManager, Log $log)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->dataCache = $dataCache;
|
||||
$this->fileManager = $fileManager;
|
||||
$this->log = $log;
|
||||
public function __construct(
|
||||
private Config $config,
|
||||
private DataCache $dataCache,
|
||||
private FileManager $fileManager,
|
||||
private Log $log
|
||||
) {
|
||||
|
||||
$this->classLoader = new ClassLoader();
|
||||
}
|
||||
|
||||
@@ -39,12 +39,9 @@ use Espo\Core\Utils\ClientManager;
|
||||
*/
|
||||
class ActionRenderer
|
||||
{
|
||||
private ClientManager $clientManager;
|
||||
|
||||
public function __construct(ClientManager $clientManager)
|
||||
{
|
||||
$this->clientManager = $clientManager;
|
||||
}
|
||||
public function __construct(private ClientManager $clientManager)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Writes to a body.
|
||||
|
||||
@@ -34,8 +34,6 @@ namespace Espo\Core\Utils\Client\ActionRenderer;
|
||||
*/
|
||||
class Params
|
||||
{
|
||||
private string $controller;
|
||||
private string $action;
|
||||
/** @var ?array<string, mixed> */
|
||||
private ?array $data;
|
||||
private bool $initAuth = false;
|
||||
@@ -43,10 +41,11 @@ class Params
|
||||
/**
|
||||
* @param ?array<string, mixed> $data
|
||||
*/
|
||||
public function __construct(string $controller, string $action, ?array $data = null)
|
||||
{
|
||||
$this->controller = $controller;
|
||||
$this->action = $action;
|
||||
public function __construct(
|
||||
private string $controller,
|
||||
private string $action,
|
||||
?array $data = null
|
||||
) {
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,14 +36,10 @@ use Espo\Core\Utils\File\Manager as FileManager;
|
||||
*/
|
||||
class DevModeJsFileListProvider
|
||||
{
|
||||
private FileManager $fileManager;
|
||||
|
||||
private const LIBS_FILE = 'frontend/libs.json';
|
||||
|
||||
public function __construct(FileManager $fileManager)
|
||||
{
|
||||
$this->fileManager = $fileManager;
|
||||
}
|
||||
public function __construct(private FileManager $fileManager)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
|
||||
@@ -29,10 +29,8 @@
|
||||
|
||||
namespace Espo\Core\Utils\Config;
|
||||
|
||||
use Espo\Core\{
|
||||
Utils\File\Manager as FileManager,
|
||||
Utils\Config,
|
||||
};
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Core\Utils\File\Manager as FileManager;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
|
||||
@@ -39,19 +39,11 @@ use RuntimeException;
|
||||
*/
|
||||
class ConfigWriter
|
||||
{
|
||||
/**
|
||||
* @var array<string, mixed>
|
||||
*/
|
||||
/** @var array<string, mixed> */
|
||||
private $changedData = [];
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
/** @var string[] */
|
||||
private $removeParamList = [];
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
/** @var string[] */
|
||||
protected $associativeArrayAttributeList = [
|
||||
'currencyRates',
|
||||
'database',
|
||||
@@ -61,25 +53,12 @@ class ConfigWriter
|
||||
|
||||
private string $cacheTimestampParam = 'cacheTimestamp';
|
||||
|
||||
private Config $config;
|
||||
|
||||
private ConfigWriterFileManager $fileManager;
|
||||
|
||||
private ConfigWriterHelper $helper;
|
||||
|
||||
private InternalConfigHelper $internalConfigHelper;
|
||||
|
||||
public function __construct(
|
||||
Config $config,
|
||||
ConfigWriterFileManager $fileManager,
|
||||
ConfigWriterHelper $helper,
|
||||
InternalConfigHelper $internalConfigHelper
|
||||
) {
|
||||
$this->config = $config;
|
||||
$this->fileManager = $fileManager;
|
||||
$this->helper = $helper;
|
||||
$this->internalConfigHelper = $internalConfigHelper;
|
||||
}
|
||||
private Config $config,
|
||||
private ConfigWriterFileManager $fileManager,
|
||||
private ConfigWriterHelper $helper,
|
||||
private InternalConfigHelper $internalConfigHelper
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Set a parameter.
|
||||
|
||||
@@ -29,10 +29,8 @@
|
||||
|
||||
namespace Espo\Core\Utils\Config;
|
||||
|
||||
use Espo\Core\{
|
||||
Utils\File\Manager as FileManager,
|
||||
Utils\Config,
|
||||
};
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Core\Utils\File\Manager as FileManager;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
@@ -112,7 +110,7 @@ class ConfigWriterFileManager
|
||||
try {
|
||||
$data = $this->fileManager->getPhpContents($path);
|
||||
}
|
||||
catch (RuntimeException $e) {
|
||||
catch (RuntimeException) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,15 +34,8 @@ use Espo\Core\Utils\Metadata;
|
||||
|
||||
class InternalConfigHelper
|
||||
{
|
||||
private $config;
|
||||
|
||||
private $metadata;
|
||||
|
||||
public function __construct(Config $config, Metadata $metadata)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->metadata = $metadata;
|
||||
}
|
||||
public function __construct(private Config $config, private Metadata $metadata)
|
||||
{}
|
||||
|
||||
public function isParamForInternalConfig(string $name): bool
|
||||
{
|
||||
|
||||
@@ -36,20 +36,13 @@ use RuntimeException;
|
||||
|
||||
class MissingDefaultParamsSaver
|
||||
{
|
||||
private Config $config;
|
||||
|
||||
private ConfigWriter $configWriter;
|
||||
|
||||
private FileManager $fileManager;
|
||||
|
||||
private string $defaultConfigPath = 'application/Espo/Resources/defaults/config.php';
|
||||
|
||||
public function __construct(Config $config, ConfigWriter $configWriter, FileManager $fileManager)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->configWriter = $configWriter;
|
||||
$this->fileManager = $fileManager;
|
||||
}
|
||||
public function __construct(
|
||||
private Config $config,
|
||||
private ConfigWriter $configWriter,
|
||||
private FileManager $fileManager
|
||||
) {}
|
||||
|
||||
public function process(): void
|
||||
{
|
||||
|
||||
@@ -30,31 +30,19 @@
|
||||
namespace Espo\Core\Utils\DateTime;
|
||||
|
||||
use Espo\Core\Utils\DateTime;
|
||||
|
||||
use Espo\Core\InjectableFactory;
|
||||
use Espo\ORM\EntityManager;
|
||||
use Espo\Core\Utils\Config;
|
||||
|
||||
use Espo\Entities\User;
|
||||
use Espo\Entities\Preferences;
|
||||
|
||||
class DateTimeFactory
|
||||
{
|
||||
private $injectableFactory;
|
||||
|
||||
private $entityManager;
|
||||
|
||||
private $config;
|
||||
|
||||
public function __construct(
|
||||
InjectableFactory $injectableFactory,
|
||||
EntityManager $entityManager,
|
||||
Config $config
|
||||
) {
|
||||
$this->injectableFactory = $injectableFactory;
|
||||
$this->entityManager = $entityManager;
|
||||
$this->config = $config;
|
||||
}
|
||||
private InjectableFactory $injectableFactory,
|
||||
private EntityManager $entityManager,
|
||||
private Config $config
|
||||
) {}
|
||||
|
||||
public function createWithUserTimeZone(User $user): DateTime
|
||||
{
|
||||
|
||||
@@ -29,48 +29,30 @@
|
||||
|
||||
namespace Espo\Core\Utils\File;
|
||||
|
||||
use Espo\Core\{
|
||||
Utils\Util,
|
||||
Utils\File\Manager as FileManager,
|
||||
Utils\Config,
|
||||
Utils\Module,
|
||||
Utils\DataCache,
|
||||
Utils\Module\PathProvider,
|
||||
};
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Core\Utils\DataCache;
|
||||
use Espo\Core\Utils\File\Manager as FileManager;
|
||||
use Espo\Core\Utils\Module;
|
||||
use Espo\Core\Utils\Module\PathProvider;
|
||||
use Espo\Core\Utils\Util;
|
||||
|
||||
use ReflectionClass;
|
||||
|
||||
class ClassMap
|
||||
{
|
||||
private FileManager $fileManager;
|
||||
|
||||
private Config $config;
|
||||
|
||||
private Module $module;
|
||||
|
||||
private DataCache $dataCache;
|
||||
|
||||
private PathProvider $pathProvider;
|
||||
|
||||
public function __construct(
|
||||
FileManager $fileManager,
|
||||
Config $config,
|
||||
Module $module,
|
||||
DataCache $dataCache,
|
||||
PathProvider $pathProvider
|
||||
) {
|
||||
$this->fileManager = $fileManager;
|
||||
$this->config = $config;
|
||||
$this->module = $module;
|
||||
$this->dataCache = $dataCache;
|
||||
$this->pathProvider = $pathProvider;
|
||||
}
|
||||
private FileManager $fileManager,
|
||||
private Config $config,
|
||||
private Module $module,
|
||||
private DataCache $dataCache,
|
||||
private PathProvider $pathProvider
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Return paths to class files.
|
||||
*
|
||||
* @param ?string[] $allowedMethods If specified, classes w/o specified method will be ignored.
|
||||
* @return array<string,class-string>
|
||||
* @return array<string, class-string>
|
||||
*/
|
||||
public function getData(
|
||||
string $path,
|
||||
|
||||
@@ -30,5 +30,4 @@
|
||||
namespace Espo\Core\Utils\File\Exceptions;
|
||||
|
||||
class FileError extends \RuntimeException
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
@@ -30,5 +30,4 @@
|
||||
namespace Espo\Core\Utils\File\Exceptions;
|
||||
|
||||
class PermissionError extends FileError
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
@@ -29,11 +29,8 @@
|
||||
|
||||
namespace Espo\Core\Utils\File;
|
||||
|
||||
use Espo\Core\{
|
||||
Utils\Util,
|
||||
Utils\Json,
|
||||
};
|
||||
|
||||
use Espo\Core\Utils\Json;
|
||||
use Espo\Core\Utils\Util;
|
||||
use Espo\Core\Utils\File\Exceptions\FileError;
|
||||
use Espo\Core\Utils\File\Exceptions\PermissionError;
|
||||
|
||||
@@ -47,9 +44,7 @@ class Manager
|
||||
{
|
||||
private Permission $permission;
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
/** @var string[] */
|
||||
private $permissionDeniedList = [];
|
||||
|
||||
protected string $tmpDir = 'data/tmp';
|
||||
|
||||
@@ -33,12 +33,8 @@ use Espo\Core\Utils\Metadata;
|
||||
|
||||
class MimeType
|
||||
{
|
||||
private Metadata $metadata;
|
||||
|
||||
public function __construct(Metadata $metadata)
|
||||
{
|
||||
$this->metadata = $metadata;
|
||||
}
|
||||
public function __construct(private Metadata $metadata)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
|
||||
@@ -35,7 +35,6 @@ use Throwable;
|
||||
|
||||
class Permission
|
||||
{
|
||||
private Manager $fileManager;
|
||||
|
||||
/**
|
||||
* Last permission error.
|
||||
@@ -99,10 +98,8 @@ class Permission
|
||||
/**
|
||||
* @param array<string, mixed> $params
|
||||
*/
|
||||
public function __construct(Manager $fileManager, array $params = null)
|
||||
public function __construct(private Manager $fileManager, array $params = null)
|
||||
{
|
||||
$this->fileManager = $fileManager;
|
||||
|
||||
if ($params) {
|
||||
foreach ($params as $paramName => $paramValue) {
|
||||
switch ($paramName) {
|
||||
@@ -609,7 +606,7 @@ class Permission
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count of a search string in a array.
|
||||
* Get count of a search string in an array.
|
||||
*
|
||||
* @param string $search
|
||||
* @param string[] $array
|
||||
|
||||
@@ -29,14 +29,12 @@
|
||||
|
||||
namespace Espo\Core\Utils\File;
|
||||
|
||||
use Espo\Core\{
|
||||
Utils\File\Manager as FileManager,
|
||||
Utils\Module,
|
||||
Utils\Util,
|
||||
Utils\DataUtil,
|
||||
Utils\Json,
|
||||
Utils\Resource\PathProvider,
|
||||
};
|
||||
use Espo\Core\Utils\DataUtil;
|
||||
use Espo\Core\Utils\File\Manager as FileManager;
|
||||
use Espo\Core\Utils\Json;
|
||||
use Espo\Core\Utils\Module;
|
||||
use Espo\Core\Utils\Resource\PathProvider;
|
||||
use Espo\Core\Utils\Util;
|
||||
|
||||
use JsonException;
|
||||
use LogicException;
|
||||
@@ -45,29 +43,21 @@ use stdClass;
|
||||
class Unifier
|
||||
{
|
||||
protected bool $useObjects = false;
|
||||
|
||||
private string $unsetFileName = 'unset.json';
|
||||
|
||||
private const APPEND_VALUE = '__APPEND__';
|
||||
|
||||
private const ANY_KEY = '__ANY__';
|
||||
|
||||
private FileManager $fileManager;
|
||||
private Module $module;
|
||||
private PathProvider $pathProvider;
|
||||
|
||||
public function __construct(FileManager $fileManager, Module $module, PathProvider $pathProvider)
|
||||
{
|
||||
$this->fileManager = $fileManager;
|
||||
$this->module = $module;
|
||||
$this->pathProvider = $pathProvider;
|
||||
}
|
||||
public function __construct(
|
||||
private FileManager $fileManager,
|
||||
private Module $module,
|
||||
private PathProvider $pathProvider
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Merge data of resource files.
|
||||
*
|
||||
* @param array<int, string[]> $forceAppendPathList
|
||||
* @return array<string, mixed>|\stdClass
|
||||
* @return array<string, mixed>|stdClass
|
||||
*/
|
||||
public function unify(string $path, bool $noCustom = false, array $forceAppendPathList = [])
|
||||
{
|
||||
@@ -111,22 +101,22 @@ class Unifier
|
||||
|
||||
/**
|
||||
* @param array<int, string[]> $forceAppendPathList
|
||||
* @return \stdClass
|
||||
* @return stdClass
|
||||
*/
|
||||
private function unifyObject(string $path, bool $noCustom = false, array $forceAppendPathList = [])
|
||||
{
|
||||
/** @var \stdClass $data */
|
||||
/** @var stdClass $data */
|
||||
$data = $this->unifySingle($this->pathProvider->getCore() . $path, true);
|
||||
|
||||
foreach ($this->getModuleList() as $moduleName) {
|
||||
$filePath = $this->pathProvider->getModule($moduleName) . $path;
|
||||
|
||||
/** @var \stdClass $itemData */
|
||||
/** @var stdClass $itemData */
|
||||
$itemData = $this->unifySingle($filePath, true);
|
||||
|
||||
$this->prepareItemDataObject($itemData, $forceAppendPathList);
|
||||
|
||||
/** @var \stdClass $data */
|
||||
/** @var stdClass $data */
|
||||
$data = DataUtil::merge($data, $itemData);
|
||||
}
|
||||
|
||||
@@ -136,17 +126,17 @@ class Unifier
|
||||
|
||||
$customFilePath = $this->pathProvider->getCustom() . $path;
|
||||
|
||||
/** @var \stdClass $itemData */
|
||||
/** @var stdClass $itemData */
|
||||
$itemData = $this->unifySingle($customFilePath, true);
|
||||
|
||||
$this->prepareItemDataObject($itemData, $forceAppendPathList);
|
||||
|
||||
/** @var \stdClass */
|
||||
/** @var stdClass */
|
||||
return DataUtil::merge($data, $itemData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>|\stdClass
|
||||
* @return array<string, mixed>|stdClass
|
||||
*/
|
||||
private function unifySingle(string $dirPath, bool $recursively)
|
||||
{
|
||||
@@ -175,7 +165,7 @@ class Unifier
|
||||
);
|
||||
|
||||
if ($this->useObjects) {
|
||||
/** @var \stdClass $data */
|
||||
/** @var stdClass $data */
|
||||
|
||||
$data->$dirName = $itemValue;
|
||||
|
||||
@@ -210,7 +200,7 @@ class Unifier
|
||||
$name = $this->fileManager->getFileName($fileName, '.json');
|
||||
|
||||
if ($this->useObjects) {
|
||||
/** @var \stdClass $data */
|
||||
/** @var stdClass $data */
|
||||
|
||||
$data->$name = $itemValue;
|
||||
|
||||
@@ -223,9 +213,9 @@ class Unifier
|
||||
}
|
||||
|
||||
if ($this->useObjects) {
|
||||
/** @var \stdClass $data */
|
||||
/** @var stdClass $data */
|
||||
|
||||
/** @var \stdClass */
|
||||
/** @var stdClass */
|
||||
return DataUtil::unsetByKey($data, $unsets);
|
||||
}
|
||||
|
||||
@@ -236,7 +226,7 @@ class Unifier
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \stdClass|array<string, mixed>
|
||||
* @return stdClass|array<string, mixed>
|
||||
* @throws JsonException
|
||||
*/
|
||||
private function getContents(string $path)
|
||||
@@ -246,10 +236,8 @@ class Unifier
|
||||
try {
|
||||
return Json::decode($fileContent, !$this->useObjects);
|
||||
}
|
||||
catch (JsonException $e) {
|
||||
throw new JsonException(
|
||||
"JSON syntax error in '{$path}'."
|
||||
);
|
||||
catch (JsonException) {
|
||||
throw new JsonException("JSON syntax error in '$path'.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,15 +34,10 @@ use Espo\Core\Utils\Module;
|
||||
class PathProvider
|
||||
{
|
||||
private string $corePath = 'application/Espo/';
|
||||
|
||||
private string $customPath = 'custom/Espo/Custom/';
|
||||
|
||||
private Module $module;
|
||||
|
||||
public function __construct(Module $module)
|
||||
{
|
||||
$this->module = $module;
|
||||
}
|
||||
public function __construct(private Module $module)
|
||||
{}
|
||||
|
||||
public function getCore(): string
|
||||
{
|
||||
|
||||
@@ -32,7 +32,6 @@ namespace Espo\Core\Utils\Resource;
|
||||
use Espo\Core\Utils\File\Manager as FileManager;
|
||||
use Espo\Core\Utils\Metadata;
|
||||
use Espo\Core\Utils\Resource\FileReader\Params;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
@@ -40,18 +39,11 @@ use RuntimeException;
|
||||
*/
|
||||
class FileReader
|
||||
{
|
||||
private $fileManager;
|
||||
|
||||
private $metadata;
|
||||
|
||||
private $pathProvider;
|
||||
|
||||
public function __construct(FileManager $fileManager, Metadata $metadata, PathProvider $pathProvider)
|
||||
{
|
||||
$this->fileManager = $fileManager;
|
||||
$this->metadata = $metadata;
|
||||
$this->pathProvider = $pathProvider;
|
||||
}
|
||||
public function __construct(
|
||||
private FileManager $fileManager,
|
||||
private Metadata $metadata,
|
||||
private PathProvider $pathProvider
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Read a resource file. Returns NULL if the file does not exists.
|
||||
|
||||
@@ -33,12 +33,8 @@ use Espo\Core\Utils\Module\PathProvider as ModulePathProvider;
|
||||
|
||||
class PathProvider
|
||||
{
|
||||
private $provider;
|
||||
|
||||
public function __construct(ModulePathProvider $provider)
|
||||
{
|
||||
$this->provider = $provider;
|
||||
}
|
||||
public function __construct(private ModulePathProvider $provider)
|
||||
{}
|
||||
|
||||
public function getCore(): string
|
||||
{
|
||||
|
||||
@@ -40,14 +40,10 @@ use stdClass;
|
||||
*/
|
||||
class Reader
|
||||
{
|
||||
private Unifier $unifier;
|
||||
private UnifierObj $unifierObj;
|
||||
|
||||
public function __construct(Unifier $unifier, UnifierObj $unifierObj)
|
||||
{
|
||||
$this->unifier = $unifier;
|
||||
$this->unifierObj = $unifierObj;
|
||||
}
|
||||
public function __construct(
|
||||
private Unifier $unifier,
|
||||
private UnifierObj $unifierObj
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Read resource data.
|
||||
|
||||
Reference in New Issue
Block a user