获取顶层作用域 data，可能为 null 值
160125
public Map getRootData() {
		for (Scope cur=this; true; cur=cur.parent) {
			if (cur.parent == null) {
				return cur.data;
			}
		}
	}
111956
@Nullable protected String encode(@Nullable byte[] data) {
    return data == null ? null : Base64.getUrlEncoder().encodeToString(data);
  }
194505
public IPromise<String> getDataSimple() {
        Promise result = new Promise();
        result.complete("Data", null);
        return result;
    }
692018
public final function getData(int $i = null)
    {
        if ($i !== null) {
            if ($i < 0) {
                $i = count($this->data) + $i; // reverse
            }
            return $this->data[$i] ?? null;
        }
        return $this->data;
    }
982114
private static Data checkData(final Data data) {
		if (Data.EMPTY.equals(data)) {
			throw new IllegalStateOfArgumentException("Argument 'data' must not be empty.");
		}
		return data;
	}
906031
function find(data) {
                if (data === this.data) {
                    return this;
                }

                if (this.children) {
                    for (var i = 0, _length = this.children.length, target = null; i < _length; i++) {
                        target = this.children[i].find(data);
                        if (target) {
                            return target;
                        }
                    }
                }

                return null;
            }
1003953
public function getData($key = null)
	{
		if ($key !== null) {
			return array_key_exists($key, $this->data) ? $this->data[$key] : null;
		}

		return $this->data;
	}
218391
public function isDataUrl()
    {
        $data = $this->decodeDataUrl($this->data);

        return is_null($data) ? false : true;
    }
833739
public function insert($data = null): IResult
    {
        if(null === $data)
        {
            $data = static::parseSaveData($this);
        }
        else if(!$data instanceof \ArrayAccess)
        {
            $data = new LazyArrayObject($data);
        }
        $query = static::query($this);

        // 插入前
        $this->trigger(ModelEvents::BEFORE_INSERT, [
            'model' => $this,
            'data'  => $data,
            'query' => $query,
        ], $this, \Imi\Model\Event\Param\BeforeInsertEventParam::class);

        $result = $query->insert($data);
        if($result->isSuccess())
        {
            foreach(ModelManager::getFields($this) as $name => $column)
            {
                if($column->isAutoIncrement)
                {
                    $this[$name] = $result->getLastInsertId();
                    break;
                }
            }
        }

        // 插入后
        $this->trigger(ModelEvents::AFTER_INSERT, [
            'model' => $this,
            'data'  => $data,
            'result'=> $result
        ], $this, \Imi\Model\Event\Param\AfterInsertEventParam::class);

        // 子模型插入
        ModelRelationManager::insertModel($this);

        return $result;
    }
267737
NodeData getData() {
    if (null == data) {
      synchronized (this) {
        if (null == data) {
          this.data = this.trie.nodes.get(index);
        }
      }
    }
    return data;
  }
480323
public BaseDataJsonFieldBo setData(JsonNode data) {
        return setData(
                data == null || data instanceof MissingNode || data instanceof NullNode ? null
                        : SerializationUtils.toJson(data));
    }
961247
public function save($data=null, $where=null)
    {
        $this->set($data, $where);
        $query = $this->getQuery();
        
        if (isset($query['table'])) {
            $table = $query['table'][0];
            $pk = $this->getPrimaryKey($table);
        } else {
            $table = $this->getTableName();
            $pk = $this->getPrimaryKey();
        }
        if (!isset($pk)) {
            throw new Exception('Can\'t get primary key of table:' . $table);
        }
        if ($data && isset($data[$pk]) && $data[$pk]) {
            $this->where([$pk => $data[$pk]]);
        }
        
        // verify data
        $mdata = $query->get('data');
        $mwhere = $query->get('where');
        
        if (!$query->formatted()) {
            $mdata = static::formatInput($mdata);
            $query->remove('data')->setRaw('data', $mdata);
            
            $res = static::verifyData($mdata);
            if ($res['errcode']) {
                return $res;
            }
        }
        
        if (static::isEmptyData($mdata)) {
            return ErrorInfo::error('没有更新的数据');
        }
        
        if (!$mwhere) {
            // clone query
            $clone = $query->clone();
            $res = static::setQuery($clone)->verifyUnique($mdata, $mwhere);
            if ($res['errcode']) {
                return $res;
            }
        }
        
        $row = null;
        if (!empty($mwhere)) {
            // clone query
            $this->setQuery($query->clone());
            $row = $this->find();
        }
        
        if ($row) {
            $this->setQuery($query)->update()->query();
            
            $id = $row[$pk];    // first row id
        } else {
            $id = $this->setQuery($query)->insert()->query(); // insert id
            
            if (!$id) {
                return ErrorInfo::error('操作未获取 insertId');
            }
        }
        
        return ErrorInfo::success(['id' => $id]);
    }
83246
public function applyData ( $data = NULL ) {
        parent::applyData( $data );
        if ($data != null) {
            self::$propData[$this->getKey()] = $this;
            self::$keyCache[$this->getClassKey()] = $this->__keyName;
            $key = $this->__keyName;
            self::$__ids[$this->getClassKey()][$this->$key] = true;
        }
    }
1189005
public function init($data = null)
    {
        $this->meta = array();

        $data = explode('*', (string)$data);

        // ...skip unilateral untagged server responses
        for ($i=0, $len=count($data); $i<$len; $i++) {
            $data_item = &$data[$i];
            if (preg_match('/^ SORT/i', $data_item)) {
                // valid response, initialize raw_data for is_error()
                $this->raw_data = '';
                $data_item = substr($data_item, 5);
                break;
            }
            else if (preg_match('/^ (E?SEARCH)/i', $data_item, $m)) {
                // valid response, initialize raw_data for is_error()
                $this->raw_data = '';
                $data_item = substr($data_item, strlen($m[0]));

                if (strtoupper($m[1]) == 'ESEARCH') {
                    $data_item = trim($data_item);
                    // remove MODSEQ response
                    if (preg_match('/\(MODSEQ ([0-9]+)\)$/i', $data_item, $m)) {
                        $data_item = substr($data_item, 0, -strlen($m[0]));
                        $this->params['MODSEQ'] = $m[1];
                    }
                    // remove TAG response part
                    if (preg_match('/^\(TAG ["a-z0-9]+\)\s*/i', $data_item, $m)) {
                        $data_item = substr($data_item, strlen($m[0]));
                    }
                    // remove UID
                    $data_item = preg_replace('/^UID\s*/i', '', $data_item);

                    // ESEARCH parameters
                    while (preg_match('/^([a-z]+) ([0-9:,]+)\s*/i', $data_item, $m)) {
                        $param = strtoupper($m[1]);
                        $value = $m[2];

                        $this->params[$param] = $value;
                        $data_item = substr($data_item, strlen($m[0]));

                        if (in_array($param, array('COUNT', 'MIN', 'MAX'))) {
                            $this->meta[strtolower($param)] = (int) $value;
                        }
                    }

// @TODO: Implement compression using compressMessageSet() in __sleep() and __wakeup() ?
// @TODO: work with compressed result?!
                    if (isset($this->params['ALL'])) {
                        $data_item = implode(self::SEPARATOR_ELEMENT,
                            rcube_imap_generic::uncompressMessageSet($this->params['ALL']));
                    }
                }

                break;
            }

            unset($data[$i]);
        }

        $data = array_filter($data);

        if (empty($data)) {
            return;
        }

        $data = array_shift($data);
        $data = trim($data);
        $data = preg_replace('/[\r\n]/', '', $data);
        $data = preg_replace('/\s+/', ' ', $data);

        $this->raw_data = $data;
    }
1617
void setData(Map<String, Object> data) {
        Objects.requireNonNull(data, "data can't be null");

        // @adovbnya DO NOT CHANGE !!!!
        // allow tenant change only from initial (empty) value or only from super tenant
        if (this.dataMap.isEmpty()) {
            this.dataMap = ValueHolder.valueOf(data);
        } else if (!Objects.equals(this.dataMap.get(), data)) {
            if (!this.tenant.isPresent()) {
                throw new IllegalStateException("Tenant doesn't set in context yet");
            }

            if (this.tenant.get().isSuper()) {
                this.dataMap = ValueHolder.valueOf(data);
            } else {

                StackTraceElement[] traces = Thread.currentThread().getStackTrace();
                if (!isAllowedToChangeTenant(traces)) {
                    throw new IllegalStateException("Trying to set the data from " + this.dataMap.get()
                                                        + " to " + data);
                }
            }
        }
    }
1325509
public function data($data, $value = null)
    {
        if (is_string($data)) {
            $this->data[$data] = $value;
        } else {
            // 清空数据
            $this->data = [];

            if (is_object($data)) {
                $data = get_object_vars($data);
            }

            if (true === $value) {
                // 数据对象赋值
                foreach ($data as $key => $value) {
                    $this->setAttr($key, $value, $data);
                }
            } else {
                $this->data = $data;
            }
        }

        return $this;
    }
646514
public function get_data() {
		$data = null;
		if ( ! empty( $this->struct['value'] ) ) {
			$data[ $this->slug ] = $this->struct['value'];
		}

		return $data;
	}