51 lines
1.0 KiB
PHP
51 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace mt;
|
|
|
|
use phpcommon;
|
|
|
|
class AttrHelper {
|
|
|
|
public static function parseAttrCfg($attrStr)
|
|
{
|
|
$attrs = array();
|
|
$strs = explode('|', $attrStr);
|
|
foreach ($strs as $str) {
|
|
$strs1 = explode('|', $attrStr);
|
|
array_push($attrs,
|
|
array(
|
|
'attr_id' => $strs1[0],
|
|
'type' => $strs1[1],
|
|
));
|
|
}
|
|
return $attrs;
|
|
}
|
|
|
|
public static function mergeAttr($aAttr, $bAttr)
|
|
{
|
|
|
|
}
|
|
|
|
public static function canMergeCfg($aAttr, $bAttr)
|
|
{
|
|
foreach ($bAttr as $attr){
|
|
if (!array_find($aAttr, function($val) use($attr) {
|
|
if ($val['attr_id'] == $attr['attr_id'] &&
|
|
$val['type'] == $attr['type']) {
|
|
return true;
|
|
}
|
|
return false;
|
|
})) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static function randAttr($attr, $outAttr)
|
|
{
|
|
|
|
}
|
|
|
|
}
|