把数据打包到Data实例内
这个方法不应该被直接调用，只提供给Mapper调用.

@internal

@param array $values
@param bool  $replace

@return $this
768753
final public function __pack(array $values, $replace)
    {
        $this->values = $replace ? $values : array_merge($this->values, $values);
        $this->dirty = [];
        $this->fresh = false;

        return $this;
    }
578271
public function to($values): self
    {
        $values = is_string($values) || is_integer($values) ? func_get_args() : $values;

        foreach ($values as $value) {
            if (! in_array($value, $this->to)) {
                $this->to[] = $value;
            }
        }

        return $this;
    }
491446
public function whereIn($field, $values)
    {
        $this->_filters[] = [$field => ['$in' => $this->normalizeValues($field, $values)]];

        return $this;
    }
317663
public static function replaceInArray($search = '', $replace = '', $array = false, $isKeys = true)
    {
        if (!is_array($array)) {
            return str_replace($search, $replace, $array);
        }

        $newArr = array();
        foreach ($array as $key => $value) {
            $addKey = $key;
            if ($isKeys) { //Replace keys
                $addKey = str_replace($search, $replace, $key);
            }

            // Recurse
            $newArr[$addKey] = static::replaceInArray($search, $replace, $value, $isKeys);
        }

        return $newArr;
    }
1045921
protected function sortReplacements(array $replace)
    {
        return (new Collection($replace))->sortBy(function ($value, $key) {
            return mb_strlen($key) * -1;
        })->all();
    }
93966
public function selected($values)
    {
        if (is_array($values) || $values instanceof Closure) {
            $this->selected = $values;
        }
        else if (func_num_args() > 1) {
            $this->selected = func_get_args();
        } else {
            $this->selected = [$values];
        }

        return $this;
    }
978368
public function mergeAttributes(SimpleXmlElement $node, $replace = true)
    {
        foreach ($node->attributes() as $name => $value) {
            if (isset($this[$name])) {
                if ($replace) {
                    $this[$name] = (string)$value;
                }

                continue;
            }

            $this->addAttribute($name, (string)$value);
        }

        return $this;
    }
1364581
public function Where($condition, $values) {
        $this->setWhere($condition);
        $this->addBindValues($values);
        return $this;
    }
561360
public function setTableAttributes($attribs = [], $replace = false)
    {
        if ($replace) {
            $this->attribs = $attribs;
        } else {
            $this->attribs = array_merge($this->attribs, $attribs);
        }

        return $this;
    }
241826
public function setParam($name, $value, $replace = true)
    {
        if (is_array($name)) {
            if (!isset($this->components[self::QUERY])) {
                $this->components[self::QUERY] = [];
            }
            TreeTools::setByPath($this->components[self::QUERY], $name, $value);
        } else {
            if (isset($this->components[self::QUERY][$name]) && !$replace) {
                return $this;
            }
            $this->components[self::QUERY][$name] = $value;
        }
        return $this;
    }
36405
public function setContent(array $content, $replace = false)
    {
        if ($replace) {
            $this->content = $content;
        } else {
            foreach ($content as $key => $value) {
                $this->content[$key] = $value;
            }
        }

        return $this;
    }
593167
public function setShape($value, $replace = true)
    {
        $name = 'shapes';
        if (!(is_array($value) || is_string($value))) {
            throw new CPS_Exception(array(array('long_message' => 'Invalid request parameter', 'code' => ERROR_CODE_INVALID_PARAMETER, 'level' => 'REJECTED', 'source' => 'CPS_API')));
        }
        if ($replace) {
            $this->_setRawParam($name, $value);
        } else {
            $exParam = $this->_getRawParam($name);
            if (!is_array($exParam)) {
                $exParam = array($exParam);
            }
            if (is_array($value)) {
                foreach($value as $val){
                    $exParam[] = $val;
                }
            } else if (is_string($value)) {
                $exParam[] = $value;
            }
            $this->_setRawParam($name, $exParam);
        }
    }
392450
public function set($key, $values, $replace = true)
    {
        if (\strpos($key, '_')) {
            $key = \str_replace('_', '-', $key);
        }

        $uniqueKey = \strtolower($key);
        if ($uniqueKey === 'set-cookie') {
            throw new \LogicException('Please use Hail\\Http\\Cookie to set cookie value');
        }

        $key = Helpers::normalizeHeaderName($uniqueKey);

        $this->headerNames[$uniqueKey] = $key;

        $values = \array_values((array) $values);

        if (true === $replace || !isset($this->headers[$key])) {
            $this->headers[$key] = $values;
        } else {
            $this->headers[$key] = \array_merge($this->headers[$key], $values);
        }

        if ('cache-control' === $uniqueKey) {
            $this->cacheControl = $this->parseCacheControl($values[0]);
        }

        // ensure the cache-control header has sensible defaults
        if (\in_array($uniqueKey, ['cache-control', 'etag', 'last-modified', 'expires'], true)) {
            $computed = $this->computeCacheControlValue();
            $this->headers['Cache-Control'] = [$computed];
            $this->headerNames['cache-control'] = 'Cache-Control';
            $this->computedCacheControl = $this->parseCacheControl($computed);
        }
    }
559064
public function insert(Query $query, $replace = false)
    {
        // 分析并处理数据
        $options = $query->getOptions();

        $data = $this->parseData($query, $options['data']);

        $bulk = new BulkWrite;

        if ($insertId = $bulk->insert($data)) {
            $this->insertId = $insertId;
        }

        $this->log('insert', $data, $options);

        return $bulk;
    }
704905
protected function setContent(array $values)
    {
        file_put_contents($this->fileName, json_encode($values));

        if (! count($values)) {
            unlink($this->fileName);
        }

        return $this;
    }
205350
public static function replace(array $values)
    {

        if (empty($values))
            return true;

        if (! is_array(reset($values))) {

            $values = [$values];

        } else {

            foreach ($values as $key => $value) {

                ksort($value);
                $values[$key] = $value;
            }
        }

        $model = self::getModel();

        $sql = static::compileReplace($model->getConnection()->getQueryGrammar(), $values);

        $values = static::inLineArray($values);

        return $model->getConnection()->affectingStatement($sql, $values);
    }
222539
public function replaceContents(Array $replacements) {
    $this->writeContents(
      str_replace(
                  array_keys($replacements),
                  array_values($replacements),
                  $this->getContents()
                 )
    );
    return $this;
  }