Skip to content

Commit

Permalink
Cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
UIMSolutions committed May 4, 2024
1 parent fa676a6 commit 5c9734b
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 126 deletions.
2 changes: 1 addition & 1 deletion caches/uim/caches/classes/engines/file.d
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class DFileCacheEngine : DCacheEngine {
if (_setKey(aKey, true) == false) {
return false;
}
if (!configuration.get("serialize"].isEmpty) {
if (!configuration.isEmpty("serialize")) {
cacheData = serialize(cacheData);
}
myexpires = time() + duration(timeToLive);
Expand Down
4 changes: 2 additions & 2 deletions caches/uim/caches/classes/engines/memory.d
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class DMemoryCacheEngine : DCacheEngine {
}
super.initialize(initData);
if (!configuration.get("host"].isEmpty) {
if (!configuration.isEmpty("host")) {
configuration.get("servers"] = configuration.get("port"].isEmpty
? [configuration.get("host"]] : [
"%s:%d".format(configuration.getString("host"), configuration.getString("port"))
Expand Down Expand Up @@ -135,7 +135,7 @@ if (isArray(configuration.get("options"])) {
configuration.get("options"].byKeyValue
.each!(optValue => _Memory.setOption(optValue.key, optValue.value));
}
if (isEmpty(configuration.get("username"]) && !configuration.get("login"].isEmpty) {
if (isEmpty(configuration.get("username"]) && !configuration.isEmpty("login")) {
throw new DInvalidArgumentException(
"Please pass " username" instead of 'login' for connecting to Memory"
);
Expand Down
2 changes: 1 addition & 1 deletion caches/uim/caches/classes/engines/redis.d
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class DRedisCacheEngine : DCacheEngine {
protected bool _connect() {
try {
_redis = new DRedis();
if (!configuration.get("unix_socket"].isEmpty) {
if (!configuration.isEmpty("unix_socket")) {
result = _redis.connect(configuration.get("unix_socket"]);
} elseif (configuration.get("persistent"].isEmpty) {
result = _redis.connect(
Expand Down
5 changes: 2 additions & 3 deletions commands/uim/commands/helpers/table.d
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class DTableHelper { // }: Helper {
foreach (index : value; row.values) {
string column = to!string(value);
pad = columnWidths[index] - _cellWidth(column);
if (!optionsToPass["style"].isEmpty) {
if (!optionsToPass.isEmpty("style")) {
column = _addStyle(column, optionsToPass["style"]);
}
if (column != "" && preg_match("#(.*)<text-right>.+</text-right>(.*)#", column, matches)) {
Expand All @@ -104,8 +104,7 @@ class DTableHelper { // }: Helper {
}
}
outputResult ~= "|";
_io.
out (outputResult);
_io.out (outputResult);
}
/**
Expand Down
18 changes: 7 additions & 11 deletions databases/uim/databases/classes/expressions/tuplecomparison.d
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,22 @@ class DTupleComparisonExpression : DComparisonExpression {
return _types;
}
/**
* Sets the value
* Params:
* Json aValue The value to compare
* /
void setValue(Json aValue) {
// Sets the value
void setValue(Json valueToCompare) {
if (this.isMulti()) {
if (isArray(aValue) && !isArray(current(aValue))) {
if (isArray(valueToCompare) && !isArray(current(valueToCompare))) {
throw new DInvalidArgumentException(
"Multi-tuple comparisons require a multi-tuple value, single-tuple given."
);
}
} else {
if (isArray(aValue) && isArray(current(aValue))) {
if (isArray(valueToCompare) && isArray(current(valueToCompare))) {
throw new DInvalidArgumentException(
"single-tuple comparisons require a single-tuple value, multi-tuple given."
);
}
}
_value = aValue;
_value = valueToCompare;
}
string sql(DValueBinder aBinder) {
Expand All @@ -75,8 +71,8 @@ class DTupleComparisonExpression : DComparisonExpression {
originalFields.each!(field => fields ~= cast(IExpression) field
? field.sql(aBinder) : field;}
string result = "(%s) %s (%s)"
.format(fields.join(", "), _operator, _stringifyValues(aBinder)); return result;
return "(%s) %s (%s)"
.format(fields.join(", "), _operator, _stringifyValues(aBinder));
}
/**
Expand Down
7 changes: 3 additions & 4 deletions models/uim/models/classes/entities/entity.d
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,9 @@ class DEntity : DElement, IEntity /* : IRegistrable */ {
if (auto myValue = values[name]) {
return myValue.toString;
}
else {
writeln("Unknown value in "~className);
return null;
}
writeln("Unknown value in "~className);
return null;
} */

void opDispatch(string name, UUID value)(UUID aValue) {
Expand Down
6 changes: 3 additions & 3 deletions orm/uim/orm/classes/entity.d
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ class DORMEntity { // }: IEntity, IInvalidProperty {
* @param Json[string] options list of options to use when creating this entity
* /
this(array myproperties = [], Json[string] optionData = null) {
options = options.update[
auto updatedOptions = options.merge([
"useSetters": Json(true),
"markClean": Json(false),
"markNew": null,
"guard": Json(false),
"source": null,
];
]);
if (!options["source"].isEmpty) {
if (!options.isEmpty("source")) {
this.setSource(options["source"]);
}
if (!options["markNew"].isNull) {
Expand Down
4 changes: 2 additions & 2 deletions orm/uim/orm/classes/tables/locator.d
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class DTableLocator { // TODO }: DAbstractLocator : ILocator {
myassociations = new AssociationCollection(this);
options["associations"] = myassociations;
}
if (options["queryFactory"].isEmpty) {
if (options.isEmpty("queryFactory")) {
options["queryFactory"] = this.queryFactory;
}
options["registryAlias"] = aliasName;
Expand All @@ -180,7 +180,7 @@ class DTableLocator { // TODO }: DAbstractLocator : ILocator {
* @param Json[string] options Table options array.
* /
protected string _getClassName(string aliasName, Json[string] optionData = null) {
if (options["className"].isEmpty) {
if (options.isEmpty("className")) {
options["className"] = aliasName;
}
if (options["className"].has("\\") && class_exists(options["className"])) {
Expand Down
9 changes: 4 additions & 5 deletions orm/uim/orm/classes/tables/table.d
Original file line number Diff line number Diff line change
Expand Up @@ -1755,11 +1755,10 @@ class DTable { //* }: IRepository, IEventListener, IEventDispatcher, IValidatorA
mydata = myentity.extract(this.getSchema().columns(), true);
myisNew = myentity.isNew();
if (myisNew) {
mysuccess = _insert(myentity, mydata);
} else {
mysuccess = _update(myentity, mydata);
}
mysuccess = myisNew
? _insert(myentity, mydata)
: _update(myentity, mydata);
if (mysuccess) {
mysuccess = _onSaveSuccess(myentity, options);
}
Expand Down

0 comments on commit 5c9734b

Please sign in to comment.