* Refactor screenModel::processXLabel.

This commit is contained in:
wangxuepeng
2023-11-25 16:47:54 +08:00
parent 8f3dadc84c
commit 098b9e4f4a
+6 -12
View File
@@ -749,23 +749,17 @@ class screenModel extends model
/**
* Process xLabel with lang
*
* @param array $xLabel
* @param string $type
* @param string $object
* @param string $field
* @param array $xLabel
* @param string $type
* @param string $object
* @param string $field
* @access public
* @return array
*/
public function processXLabel($xLabels, $type, $object, $field)
public function processXLabel(array $xLabels, string $type, string $object, string $field): array
{
$options = $this->getSysOptions($type, $object, $field);
$xLabelValues = array();
foreach($xLabels as $index => $label)
{
$xLabelValues[$label] = isset($options[$label]) ? $options[$label] : $label;
}
return $xLabelValues;
return array_map(function($label)use($options){return isset($options[$label]) ? $options[$label] : $label;}, $xLabels);
}
/**