6.X/traits/utils.php
/**
     * Parse an enum descriptor string into an enum array
     *
     * @param $name Enum name (code)
     * @param $list Values list string (e.g. '10=Yes,20=No')
     */
Parse an enum descriptor string into an enum array
@param $name Enum name (code)
@param $list Values list string
Parse an enum descriptor string into an enum array @param $name Enum name ( code ) @param $list Values list string
public function make_enum($name, $list)
    {
        $lst = [];
        $x = explode(";", $list);
        foreach ($x as $v) {
            $xx = explode("=", $v, 3);
            $e = [];
            $e['code'] = trim($xx[0]);
            if(strval(intval($e['code'])) == $e['code']){
                $e['code'] = intval($e['code']);
            }
            $e['value'] = $xx[1];
            $dx = explode(",", $xx[2]);
            foreach($dx as $vv){
                if ($vv) {
                    $e[$vv] = 1;
                }
            }
            if ($e['str']) {
                $e['code'] = strval($e['code']);
            }
            $lst[] = $e;
        }
        $this->enum[$name] = $lst;
    }
public function make_enum ( $ name , $ list ) { $ lst = [ ] ; $ x = explode ( " ; " , $ list ) ; foreach ( $ x as $ v ) { $ xx = explode ( " = " , $ v , 3 ) ; $ e = [ ] ; $ e [ 'code' ] = trim ( $ xx [ 0 ] ) ; if ( strval ( intval ( $ e [ 'code' ] ) ) == $ e [ 'code' ] ) { $ e [ 'code' ] = intval ( $ e [ 'code' ] ) ; } $ e [ 'value' ] = $ xx [ 1 ] ; $ dx = explode ( " , " , $ xx [ 2 ] ) ; foreach ( $ dx as $ vv ) { if ( $ vv ) { $ e [ $ vv ] = 1 ; } } if ( $ e [ 'str' ] ) { $ e [ 'code' ] = strval ( $ e [ 'code' ] ) ; } $ lst [ ] = $ e ; } $ this -> enum [ $ name ] = $ lst ; }
Parse an enum descriptor string into an enum array
 @param $name Enum name (code)
 @param $list Values list string (e.g.
Parse an enum descriptor string into an enum array @param $name Enum name ( code ) @param $list Values list string ( e . g .