转载数据
@param string|array $data
@param string|array $key
@param array $excludes 排除的数组
@return bool
@throws \Exception
484696
public function load($data = null, $key = null, $excludes = []) {
        if (is_string($data)) {
            list($key, $excludes, $data) = [$data, $key, null];
        }
        if (is_array($key)) {
            list($key, $excludes) = [null, $key];
        }
        if (!is_array($data) && app('request')->isPost()) {
            $data = app('request')->get($key);
        }
        if (empty($data)) {
            return false;
        }
        if (!empty($excludes)) {
            $data = array_diff_key($data, array_flip((array)$excludes));
        }
        $this->set($data);
        return true;
    }
1351541
private function isExclude(string $key): bool
    {
        if (!empty($this->excludes) && in_array($key, $this->excludes, true)) {
            return true;
        }

        if (!empty($this->only) && !in_array($key, $this->only, true)) {
            return true;
        }

        return false;
    }
723295
public static function arrExclude(array $arr, array $excludeKeys)
    {
        $result = [];
        foreach ($arr as $key => $val) {
            if (!in_array($key, $excludeKeys)) {
                $result[$key] = $val;
            }
        }
        return $result;
    }
51251
protected function unSerializeHandler($data, $keys = [], $len = 0)
    {
        // 如果值是null，直接返回false
        if (null === $data) {
            return false;
        }

        if ('OK' === $data) {
            return $data;
        }

        try {
            //mget
            if (!empty($keys) && is_array($data)) {
                $ret = [];
                array_walk($data, function ($val, $k) use ($keys, $len, &$ret) {
                    if (!is_null($val)) {
                        $key = substr($keys[$k], $len);
                        $val = $this->realUnserialize($val);
                        $ret[$key] = $val;
                    }
                });

                $data = $ret;
            } elseif (is_array($data) && empty($keys)) {
                //eval sRandMember...
                $ret = [];
                array_walk($data, function ($val, $k) use (&$ret) {
                    if (is_array($val)) {
                        foreach ($val as $i => $v) {
                            $val[$i] = $this->realUnserialize($v);
                        }
                    } else {
                        $val = $this->realUnserialize($val);
                    }

                    $ret[$k] = $val;
                });

                $data = $ret;
            } else {
                //get
                $data = $this->realUnserialize($data);
            }
        } catch (\Exception $exception) {
            // do noting
        }

        return $data;
    }
960201
public static function only($data, array $fields)
    {
        if (is_array($data)) {
            return array_intersect_key($data, array_flip($fields));
        } elseif (is_object($data)) {
            $keeps = array_keys(array_diff_key(get_object_vars($data), array_flip($fields)));

            foreach ($keeps as $key) {
                if (property_exists($data, $key)) {
                    unset($data->$key);
                }
            }

            return $data;
        }

        throw new \InvalidArgumentException('Argument 1 not array or object');
    }
1148206
public function my_pub($topic, $data, $excludeUids = [])
    {
        $this->th_pub($topic, $data, $excludeUids);
        foreach ($this->client as $client) {
            $client->pub($topic, $data, $excludeUids);
        }
    }
1147284
protected function get(string $key, array $data = null)
    {
        /**
         * @var $loader mixed
         */
        $loader = $this->loader($key) ?: $data;

        if (null === $loader)
        {
            return true;
        }

        $mixed = [];

        if ($loader)
        {
            $mixed = $loader;

            if (\is_object($mixed))
            {
                $mixed = $loader->asArray();
            }
        }

        return $this->getLexemes($key, $mixed);
    }
971851
public function updateIndexOne(array $data)
    {
        if (!is_array($data)) {
            throw new \Exception('你的索引参数不是一个数组');
        }

        if (count($data) == count($data, 1)) {
            // 一维数组
            $this->getIndex()->update(new \XSDocument($data));
        }

        //索引是否立即生效
        if ($this->flush_index) {
            $this->getIndex()->flushIndex();
        }

        return $this->getIndex();
    }
378776
protected function excluded($data)
    {
        $isExcluded = false;
        //Check global exclusion in SiteConfig
        $config = SiteConfig::current_site_config();

        //IF private tags exclusion if configured and object has private tags
        if (!empty($config->HailExcludePrivateTagsIDs) && isset($data['private_tags']) && count($data['private_tags']) > 0) {
            $private_tags = json_decode($config->HailExcludePrivateTagsIDs);
            foreach ($data['private_tags'] as $tag) {
                if (in_array($tag['id'], $private_tags)) {
                    $isExcluded = true;
                    break;
                }
            }
        }
        //IF public tags exclusion if configured and object has public tags
        if (!empty($config->HailExcludePublicTagsIDs) && isset($data['tags']) && count($data['tags']) > 0) {
            $public_tags = json_decode($config->HailExcludePublicTagsIDs);
            foreach ($data['tags'] as $tag) {
                if (in_array($tag['id'], $public_tags)) {
                    $isExcluded = true;
                    break;
                }
            }
        }

        $this->extend('updateExcluded', $isExcluded, $data);

        return $isExcluded;
    }
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;
	}
287818
public static function has(array $data, $key)
	{
		foreach (explode('.', $key) as $segment) {
			if (!is_array($data)) {
				return false;
			}

			if (!array_key_exists($segment, $data)) {
				return false;
			}

			$data = $data[$segment];
		}

		return true;
	}
949789
protected static function requireValue($data, $key)
    {
        if (isset($data[$key])) {
            return $data[$key];
        } else {
            throw new Exception\InvalidDataException("Required value for '$key' is missing");
        }
    }
137237
public static function validateSSL(string $data, XMLSecurityKey $key) : void
    {
        $container = ContainerSingleton::getInstance();
        $keyInfo = openssl_pkey_get_details($key->key);
        if ($keyInfo === false) {
            throw new \Exception('Unable to get key details from XMLSecurityKey.');
        }

        if (!isset($keyInfo['key'])) {
            throw new \Exception('Missing key in public key details.');
        }

        if ($keyInfo['key'] !== $data) {
            $container->getLogger()->debug('Key on SSL connection did not match key we validated against.');

            return;
        }

        $container->getLogger()->debug('Message validated based on SSL certificate.');
    }
443536
protected function excludes($excludes)
    {
        $excludes = \is_array($excludes) ? $excludes : \func_get_args();

        $this->excludes = $excludes;

        return $this;
    }
1042700
public function parseExcludes($excludes)
    {
        $this->requestedExcludes = [];

        if (is_string($excludes)) {
            $excludes = explode(',', $excludes);
        }

        if (! is_array($excludes)) {
            throw new \InvalidArgumentException(
                'The parseExcludes() method expects a string or an array. '.gettype($excludes).' given'
            );
        }

        foreach ($excludes as $excludeName) {
            $excludeName = $this->trimToAcceptableRecursionLevel($excludeName);

            if (in_array($excludeName, $this->requestedExcludes)) {
                continue;
            }

            $this->requestedExcludes[] = $excludeName;
        }

        return $this;
    }
161833
public static function createFromArray($key, array $data = [])
    {
        $webFormBody = new static($key);

        if (isset($data['formParameters'])) {
            foreach ($data['formParameters'] as $namedParam => $namedParamData) {
                if (\is_array($namedParamData)) {
                    $webFormBody->addParameter(NamedParameter::createFromArray($namedParam, $namedParamData));
                }
            }
        }

        return $webFormBody;
    }
277796
private function checkDataSet(array $data, $key, $isNew)
    {
        $keyExists = array_key_exists($key, $data);

        if (($isNew && !($keyExists && $data[$key] !== null)) || (!$keyExists || $data[$key] === null)) {
            throw new MissingShippingAttributeException($key);
        }

        return $keyExists;
    }