初始化短信
@throws InvalidConfigException
771814
public function init()
    {
        parent::init();
        if (empty ($this->accessId)) {
            throw new InvalidConfigException ('The "accessId" property must be set.');
        }
        if (empty ($this->accessKey)) {
            throw new InvalidConfigException ('The "accessKey" property must be set.');
        }
        if (empty ($this->signName)) {
            throw new InvalidConfigException ('The "signName" property must be set.');
        }
    }
845042
public function init()
    {
        if ($this->source === null) {
            throw new InvalidConfigException('"source" cannot be null.');
        }
        Html::addCssClass($this->htmlOptions, Enum::VIDEO_FLEXVIDEO);
        if ($this->widescreen) {
            Html::addCssClass($this->htmlOptions, Enum::VIDEO_WIDESCREEN);
        }
        if ($this->vimeo) {
            Html::addCssClass($this->htmlOptions, Enum::VIDEO_VIMEO);
        }
        parent::init();
    }
227561
protected function validateConfig()
    {
        $defaults = [
            'tpl_folder',
            'cache_folder',
            'tpl_file_format',
            //'compress',
            //'event_emitter',
        ];

        foreach ($defaults as $key) {
            if (! isset($this->config[$key])) {
                throw new InvalidConfigException(sprintf("Missing a configuration key (%s)", $key));
            }
        }
    }
137688
public function init()
    {
        if (empty($this->models) && !$this->modelClass) {
            throw new InvalidConfigException('You must at least specify "models" or "modelClass"');
        }

        if ($this->form !== null && !$this->form instanceof ActiveForm) {
            throw new InvalidConfigException('Property "form" must be an instance of yii\widgets\ActiveForm');
        }

        if (!is_array($this->models)) {
            throw new InvalidConfigException('Property "models" must be an array');
        }

        if ($this->models) {
            $modelClasses = [];
            foreach ($this->models as $model) {
                if (!$model instanceof Model) {
                    throw new InvalidConfigException('Model has to be an instance of yii\base\Model');
                }

                $modelClasses[get_class($model)] = true;
            }

            if (count($modelClasses) > 1) {
                throw new InvalidConfigException("You cannot use models of different classes");
            }

            $this->modelClass = key($modelClasses);
        }

        parent::init();
    }
134435
public function getConfig($key = '')
    {
        if (empty($key)) {
            return $this->_config;
        }

        if (!\array_key_exists($key, $this->_config)) {
            throw new InvalidException('Config key is not set: '.$key);
        }

        return $this->_config[$key];
    }
991744
public function init()
    {
        if ($this->form !== null && !$this->form instanceof ActiveForm) {
            throw new InvalidConfigException('Property "form" must be an instance of yii\widgets\ActiveForm');
        }

        if ($this->showGeneralError && $this->field === null) {
            $this->showGeneralError = false;
        }

        $this->guessColumns();
        $this->initData();

        parent::init();
    }
1363851
public function registerFormatter()
    {
        if ($this->module->formatterComponent !== true && !is_string($this->module->formatterComponent) && !is_array($this->module->formatterComponent)) {
            throw new InvalidConfigException('Invalid value for the formatterComponent parameter.');
        }
        if (is_string($this->module->formatterComponent)) {
            return;
        }
        $this->module->set('podium_formatter', is_array($this->module->formatterComponent)
                ? $this->module->formatterComponent
                : [
                    'class' => 'yii\i18n\Formatter',
                    'timeZone' => 'UTC',
                ]);
    }
528551
public function init()
    {
        parent::init();

        if (!$this->name) {
            throw new InvalidConfigException('The icon name must be specified.');
        }

        if ($this->position === null) {
            $this->position = 'left';
        }

        Html::addCssClass($this->options, ['material-icons', $this->position]);
    }
114488
public function run(): string
    {
        if (null === $this->language) {
            throw new InvalidConfigException('Language model is not defined.');
        }

        if (strpos($this->name, '.') !== false) {

            $out = $this->getDataByPath($this->name);

        } else {
            $out = $this->model->{$this->name.'_'.$this->language->getShortName()};
        }

        return empty($out) ? $this->default : $out;
    }
400539
public function init()
    {
        parent::init();

        // check for BC
        if (!empty($this->cookieName)) {
            if (!preg_match("/^[a-zA-Z0-9-_]+$/", $this->cookieName)) {
                throw new InvalidConfigException('Invalid cookieName');
            }
            $this->cookie = [
                'name' => $this->cookieName,
                'value' => [$this->cookieName, $this->cookieValue],
                'options' => $this->cookieOptions,
            ];
        }
    }
935053
public function init()
    {
        parent::init();
        if (empty ($this->appId)) {
            throw new InvalidConfigException ('The "appId" property must be set.');
        }
        if (empty ($this->appSecret)) {
            throw new InvalidConfigException ('The "appSecret" property must be set.');
        }
        if ($this->cache !== null) {
            $this->cache = Instance::ensure($this->cache, Cache::class);
        }
    }
30943
public function init()
    {
        if ($this->model === null) {
            throw new InvalidConfigException('Please specify the "model" property.');
        }

        $this->dataProvider = new ArrayDataProvider(['allModels' => [$this->model]]);
        parent::init();
    }
538326
protected function validateStateConfig()
	{
		if (empty($this->stateConfig)) {
			$msg = Yii::t('app', 'Empty state configurations are not allowed');
			throw new InvalidConfigException($msg);
		}

		$config = &$this->stateConfig;
		foreach ($config as $i=>&$state) {
			//validate label and value
			if (empty($state['value']) || empty($state['label'])) {
				$msg = Yii::t('app', 'The label and the value of a state are mandatory');
				throw new InvalidConfigException($msg);
			}
			if (!is_int($state['value']) && !is_string($state['value'])) {
				$msg = Yii::t('app', 'The value must be a string or an integer ({lbl})', ['lbl'=>$state['label']]);
				throw new InvalidConfigException($msg);
			}

			//validate closures
			$callbackAttributes = ['preconditionCallback', 'enterStateCallback', 'leaveStateCallback'];
			foreach ($callbackAttributes as $cbAttr) {
				if (isset($state[$cbAttr]) && !($state[$cbAttr] instanceof \Closure)) {
					$msg = Yii::t('app', 'For {cb-attr} only closures are allowed', ['cb-attr'=>$cbAttr]);
					throw new InvalidConfigException($msg);
				}
			}

			//default settings
			if (!isset($state['groups'])) $state['groups'] = [];
			if (!isset($state['autoEnter'])) $state['autoEnter'] = true;

			//validate groups
			foreach ($state['groups'] as &$group) {
				if (!is_string($group)) {
					$msg = Yii::t('app', 'Only strings allowed for group names');
					throw new InvalidConfigException($msg);
				}
				$group = strtolower($group);
			}
		}

		return true;
	}
109510
public function init()
    {
        if ($this->dataProvider === null) {
            throw new InvalidConfigException('The "dataProvider" property must be set.');
        }
        if ($this->emptyText === null) {
            $this->emptyText = Yii::t('yii', 'No results found.');
        }
        if (!isset($this->options['id'])) {
            $this->options['id'] = $this->getId();
        }

        if ($this->formatter == null) {
            $this->formatter = Yii::$app->getFormatter();
        } elseif (is_array($this->formatter)) {
            $this->formatter = Yii::createObject($this->formatter);
        }
        if (!$this->formatter instanceof Formatter) {
            throw new InvalidConfigException('The "formatter" property must be either a Format object or a configuration array.');
        }

        if (!$this->keyColumnName) {
            throw new InvalidConfigException('The "keyColumnName" property must be specified"');
        }
        if (!$this->parentColumnName) {
            throw new InvalidConfigException('The "parentColumnName" property must be specified"');
        }

        $this->initColumns();
    }
600372
public function init(): void
    {
        parent::init();

        if ($this->name === null || !\is_string($this->name) || $this->name === '') {
            throw new InvalidConfigException('Formatter name must be defined');
        }
        if ($this->path === null) {
            throw new InvalidConfigException('File path property must be defined and be not empty');
        }
        foreach ($this->formatAdapterArray as $i => $formatAdapter) {
            $this->formatAdapterArray[$i] = Container::createObject($formatAdapter);

            if (!($this->formatAdapterArray[$i] instanceof IFormatAdapter)) {
                throw new InvalidConfigException(sprintf('Format adapter must be instance of %s.', IFormatAdapter::class));
            }
        }
    }
305053
private static function init()
    {
        $config = Config::getEnv("database.redis");
        if (empty($config)) {
            throw new \InvalidArgumentException("配置项'database.redis'不能为空");
        }
        $config = (array) $config;
        $db_conn_name_list = \Qp\Kernel\Database\QpDB::getConnectionNameList();

        foreach ($config as $name => $data) {
            $name = strval($name);
            if (in_array($name, $db_conn_name_list)) {
                throw new \InvalidArgumentException("配置项'database.redis'的连接名'{$name}'和其他类型的数据库连接名冲突");
            }

            $data = (array) $data;
            if (empty($data)) {
                throw new \InvalidArgumentException("配置项'database.redis.{$name}'必须为非空数组");
            }
            $conn_name = $name;
            self::handleConfigArr($data, 'host', $host);
            self::handleConfigArr($data, 'auth', $auth);
            self::handleConfigArr($data, 'database', $database);
            self::handleConfigArr($data, 'port', $port);
            self::handleConfigArr($data, 'prefix', $prefix);

            $prefix = strval($prefix);
            if ($prefix == "") {
                $data['prefix'] = ":";
            } else {
                $data['prefix'] = "_" . $prefix . ":";
            }

            self::$config_list[$conn_name] = new ConfigObj($conn_name, $host, $auth, $database, $port, $data['prefix'], $data);
        }

        if (self::$frontCache === null) {
            self::$frontCache = new \Phalcon\Cache\Frontend\Data(self::$frontCacheData);
        }
    }
1005463
public function run()
    {
        Yii::$app->response->format = Response::FORMAT_JSON;
        $param = Yii::$app->request->get($this->clientIdGetParamName);
        if (mb_strlen($param) < 2) {
            if (YII_DEBUG) {
                throw new InvalidConfigException ("Operator '{$this->clientIdGetParamName}' requires two operands.");
            } else {
                return [];
            }
        } else {
            $query = Tag::find();
            $rows = $query->select(['id', 'name', 'name as text', 'frequency'])
                ->where(['like', 'name', $param])
                ->orderBy(['frequency' => SORT_DESC])
                ->limit(Yii::$app->request->get($this->clientLimitGetParamName, 20))
                ->asArray()
                ->all();
            return $rows;
        }
    }