Skip to content

Commit

Permalink
MNT Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Sep 7, 2021
1 parent 7f48451 commit 5633029
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/Fields/KeyValueField.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public function Field($properties = [])
$nameKey = $this->name.'[key][]';
$nameVal = $this->name.'[val][]';
$fields = [];
$keyFieldPlaceholder = $this->getKeyFieldPlaceholder();
$valueFieldPlaceholder = $this->getValueFieldPlaceholder();

if ($this->value) {
foreach ($this->value as $i => $v) {
Expand All @@ -105,8 +107,8 @@ public function Field($properties = [])
$valField = HTML::createTag('span', $fieldAttr, Convert::raw2xml($v));
$fields[] = $keyField.$valField;
} else {
$keyField = $this->createSelectList($i, $nameKey, $this->sourceKeys, $i, $this->getKeyFieldPlaceholder());
$valField = $this->createSelectList($i, $nameVal, $this->sourceValues, $v, $this->getValueFieldPlaceholder());
$keyField = $this->createSelectList($i, $nameKey, $this->sourceKeys, $i, $keyFieldPlaceholder);
$valField = $this->createSelectList($i, $nameVal, $this->sourceValues, $v, $valueFieldPlaceholder);
$fields[] = $keyField.' '.$valField;
}
}
Expand All @@ -115,8 +117,8 @@ public function Field($properties = [])
}

if (!$this->readonly) {
$keyField = $this->createSelectList('new', $nameKey, $this->sourceKeys, '', $this->getKeyFieldPlaceholder());
$valField = $this->createSelectList('new', $nameVal, $this->sourceValues, '', $this->getValueFieldPlaceholder());
$keyField = $this->createSelectList('new', $nameKey, $this->sourceKeys, '', $keyFieldPlaceholder);
$valField = $this->createSelectList('new', $nameVal, $this->sourceValues, '', $valueFieldPlaceholder);
$fields[] = $keyField.' '.$valField;
// $fields[] = $this->createSelectList('new', $name, $this->source);
}
Expand Down
5 changes: 3 additions & 2 deletions src/ORM/FieldType/MultiValueField.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,13 @@ public function __toString()

return '';
}

public function ItemByKey()
{
$values = $this->getValue();
if(array_keys($values) == range(0, count($values) - 1))
if (array_keys($values) == range(0, count($values) - 1)) {
$values = [];
}
return new ArrayData($values);
}

Expand Down

0 comments on commit 5633029

Please # to comment.