public function filterProtectedData($data)
    {
        if ($data && isset($this['fields']) && isset($this['protected_fields']) && $this['protected_fields']) {
            if (isset($data[0]) || is_numeric(key($data))) {
                foreach ($data as $k => $v) {
                    $data[$k] = static::filterProtectedData($v);
                }
            } else {
                $fields = array_keys($this['fields']);
                $pfields = StringHelper::toArray($this['protected_fields']);
                foreach ($data as $k => $v) {
                    if (in_array($k, $fields) && in_array($k, $pfields)) {
                        unset($data[$k]);
                    }
                }
            }
        }
        
        return $data;
    }
public function filterProtectedData($data)
    {
        if ($data && isset($this['fields']) && isset($this['protected_fields']) && $this['protected_fields']) {
            if (isset($data[0]) || is_numeric(key($data))) {
                foreach ($data as $k => $v) {
                    $data[$k] = static::filterProtectedData($v);
                }
            } else {
                $fields = array_keys($this['fields']);
                $pfields = StringHelper::toArray($this['protected_fields']);
                foreach ($data as $k => $v) {
                    if (in_array($k, $fields) && in_array($k, $pfields)) {
                        unset($data[$k]);
                    }
                }
            }
        }
        
        return $data;
    }
public function filterProtectedData ( $ data ) { if ( $ data && isset ( $ this [ 'fields' ] ) && isset ( $ this [ 'protected_fields' ] ) && $ this [ 'protected_fields' ] ) { if ( isset ( $ data [ 0 ] ) || is_numeric ( key ( $ data ) ) ) { foreach ( $ data as $ k => $ v ) { $ data [ $ k ] = static :: filterProtectedData ( $ v ) ; } } else { $ fields = array_keys ( $ this [ 'fields' ] ) ; $ pfields = StringHelper :: toArray ( $ this [ 'protected_fields' ] ) ; foreach ( $ data as $ k => $ v ) { if ( in_array ( $ k , $ fields ) && in_array ( $ k , $ pfields ) ) { unset ( $ data [ $ k ] ) ; } } } } return $ data ; }
ensure remain public data
@param  array $data
@return array
ensure remain public data