设置一页的数据
@param array|Builder $data
@return $this
@throws \Exception
426003
public function setPage($data) {
		if ($data instanceof Builder) {
			$data = $data->limit($this->getLimit())->all();
		}
		$this->setAttribute($data);
		return $this;
	}
1315293
public function rows($data)
    {
        if ($data instanceof Arrayable) {
            $data = $data->toArray();
        }

        $this->setRowsData($data);

        return $this;
    }
165579
public function initFromArray(array $data) {

        if (!empty($data['message'])) {
            return $this;
        }

        return $this->setTime($data[0])
            ->setLow($data[1])
            ->setHigh($data[2])
            ->setOpen($data[3])
            ->setClose($data[4])
            ->setVolume($data[5]);

    }
287794
public function setData(array $data)
    {
        parent::setData($data);

        $this->setChoices($this->buildChoicesFromSprite());

        return $this;
    }
967312
public function setData($data) {
        if ($data instanceof \Traversable) {
            $this->data = iterator_to_array($data);
        } else {
            $this->data = $data;
        }

        if (!empty($this->getOrder())) {
            $this->toSort = true;
        }

        return $this;
    }
182828
public function create(array $data): Model
    {
        $result = $this->repo->create($data);
        $pid = empty($data['pid']) ? 0 : $data['pid'];


        if ((int)$pid !== 0) {
            // 计算根id
            $parent = $this->show($data['pid']);
            $rootId = $parent->root_id;
            // 计算深度
            $deep = (int)$parent->deep + 1;
            // 计算path
            $path = $parent->path . $result->id . ",";
        } else {
            // 计算根id
            $rootId = $result->id;
            // 计算深度
            $deep = 0;
            // 计算path
            $path = "," . $result->id . ",";
        }

        /*
         | 将根id和分类深度写回去
         | 使用save方法
         */
        $result->root_id = $rootId;
        $result->deep = $deep;
        $result->path = $path;
        if (! $result->save()) {
            throw new CommodityCateException("商品分类没有添加成功", ExceptionCode::CREATED_FAILURE);
        }

        return $result;
    }
1324378
public function set(array $data): CollectionInterface
    {
        foreach ($data as $row) {
            $this->add($row);
        }

        return $this;
    }
138067
public function initFromArray(array $data) {

        $this->traitInitFromArray($data);

        if (!empty($data['total'])) {
            $this->setTotal((new LimitAmount())->initFromArray($data['total']));
        }

        if (!empty($data['remaining'])) {
            $this->setRemaining((new LimitAmount())->initFromArray($data['remaining']));
        }

        return $this;

    }
708099
public function setData(array $data)
    {
        if (count($data)) {
            $data = array_combine($data, $data);
        }

        $this->_data = $data;

        return $this;
    }
1017963
public static function fromArray(array $data)
	{
		return new self(
			!empty($data['code'])    ? $data['code']    : null,
			!empty($data['message']) ? $data['message'] : null,
			!empty($data['data'])    ? $data['data']    : null
		);
	}
1221185
public function init($data = null)
    {
        if ($this->initialized) {
            return $this;
        }

        if (is_null($data)) {
            $data = $this->fetchData();
        }

        if ($this->isInitialized($data)) {
            $this->initialized = true;
        }

        $this->data = $data;
        if ($this->initialized) {
            $this->onData($data);
        }

        return $this;
    }
916227
public function update(array $data)
    {
        $where = [];
        $options = $this->parseExpress();
        $data    = array_merge($options['data'], $data);
        if (isset($options['cache']) && is_string($options['cache']['key'])) {
            $key = $options['cache']['key'];
        }
        $pk = $this->getPk();
        if (empty($options['where'])) {
            // 如果存在主键数据 则自动作为更新条件
            if (is_string($pk) && isset($data[$pk])) {
                $where[$pk] = $data[$pk];
                $key        = 'mongo:' . $options['table'] . '|' . $data[$pk];
                unset($data[$pk]);
            } elseif (is_array($pk)) {
                // 增加复合主键支持
                foreach ($pk as $field) {
                    if (isset($data[$field])) {
                        $where[$field] = $data[$field];
                    } else {
                        // 如果缺少复合主键数据则不执行
                        throw new Exception('miss complex primary data');
                    }
                    unset($data[$field]);
                }
            }
            if (!isset($where)) {
                // 如果没有任何更新条件则不执行
                throw new Exception('miss update condition');
            } else {
                $options['where']['$and'] = $where;
            }
        } elseif (!isset($key) && is_string($pk) && isset($options['where']['$and'][$pk])) {
            $key = $this->getCacheKey($options['where']['$and'][$pk], $options);
        }

        // 生成bulkWrite对象
        $bulk         = $this->builder->update($data, $options);
        $writeConcern = isset($options['writeConcern']) ? $options['writeConcern'] : null;
        $writeResult  = $this->execute($options['table'], $bulk, $writeConcern);

        $result = $writeResult->getModifiedCount();
        if ($result) {
            if (isset($where[$pk])) {
                $data[$pk] = $where[$pk];
            } elseif (is_string($pk) && isset($key) && strpos($key, '|')) {
                list($a, $val) = explode('|', $key);
                unset($a);
                $data[$pk]     = $val;
            }
            $options['data'] = $data;
            $this->trigger('after_update', $options);
        }
        return $result;
    }
633983
public function send($data)
    {
        $token = $this->grantToken();
        $newData = $data;
        foreach($token as $k=>$v) {
            $newData[$k] = $v;
        }

        //必填 消息发送类型,其值为unicast,listcast,broadcast,groupcast或customizedcast
        if(!isset($data['type'])) {
            throw new Exception('need param: type');
        }

        // 可选 当type=customizedcast时,开发者填写自己的alias,友盟根据alias进行反查找,得到对应的device_token。多个alias时用英文逗号分,不能超过50个。
        if(isset($data['alias']) && !empty($data['alias'])) {
            if(is_array($data['alias'])) {
                $newData['alias'] = implode(',', $data['alias']);
            } else {
                $newData['alias'] = $data['alias'];
            }
        }

        // 必填 消息类型，值为notification或者message
        if(!isset($data['payload']['display_type'])) {
            $newData['payload']['display_type'] = 'notification';
        }

        // 必填 通知栏提示文字。但实际没有用，todo确认
        if(!isset($data['payload']['body']['ticker'])) {
            $newData['payload']['body']['ticker'] = $data['payload']['body']['title'];
        }

        //可选 消息描述。用于友盟推送web管理后台，便于查看。
        if(!isset($data['description'])) {
            $newData['description'] = $data['payload']['body']['title'];
        }
        
        $defaultTrueParams = array(
            // 通知到达设备后的提醒方式
            'play_vibrate', // 可选 收到通知是否震动,默认为"true".注意，"true/false"为字符串
            'play_lights',  // 可选 收到通知是否闪灯,默认为"true"
            'play_sound',   // 可选 收到通知是否发出声音,默认为"true"
        );

        foreach($defaultTrueParams as $one) {
            if(isset($data['payload']['body'][$one]) && ($data['payload']['body'][$one] == false || $data['payload']['body'][$one] == 'false')) {
                $newData['payload']['body'][$one] = 'false';
            }
        }

        $http = new \HTTPRequest($this->conf['api_uri_prefix'] . 'api/send', HTTP_METH_POST);
        $http->setBody(json_encode($newData));
        $http->send();
        $body = $http->getResponseBody();
        if($http->getResponseCode() != 200) {
            throw new Exception($body);
        }
        $tmp = json_decode($body, true);

        if(!isset($tmp['ret']) || $tmp['ret'] != 'SUCCESS') {
            throw new Exception($body);
        }
        return true;
    }
409379
public function setData($data)
    {
        if ($this->getType() == PdfConverter::URL && strpos(substr($data, 0, 5), 'http') === false) {
            throw new \Exception(sprintf('Error : Given URL MUST contain the protocol. Current : %s', $data));
        }
        $this->data = $data;

        return $this;
    }
328225
public function checkData(array $data) 
	{
		$keys = array('to', 'fullname', 'title', 'activationLink', 'siteurl', 'cdnurl', 'siteName');
		
		foreach($keys as $key) {
			if(!array_key_exists($key, $data)) {
				throw new \Exception('Key not in data');
			}
		}
		
		return $this;
	}
714477
public function setData($data = [])
    {
        $this->data = $data;
        $this->debug->info(__FUNCTION__, 'setData: ', $this->data);

        return $this;
    }
1226576
public function setDataFromArray(array $data)
    {
        foreach ($data as $property => $value) {
            $method = 'set' . ucfirst($property);
            if (method_exists($this, $method)) {
                $this->{$method}($value);
            } else {
                throw new \Parable\Routing\Exception(
                    "Tried to set non-existing property '{$property}' with value '{$value}' on " . get_class($this)
                );
            }
        }

        $this->checkValidProperties();
        $this->parseUrlParameters();

        return $this;
    }