public function init() { parent::init(); if (!$this->clientID || !$this->clientSecret) { throw new InvalidParamException(); } }
public function init() { parent::init(); if (!in_array($this->defaultLocale, $this->enableLocales)) { throw new \yii\base\InvalidParamException('Default locale must be contained in the enable locales list.'); } }
public function init() { parent::init(); if (Yii::$app->view !== null) { Yii::$app->view->on(yii\web\View::EVENT_BEGIN_PAGE, [$this, 'eventSetMeta']); } }
public function init() { parent::init(); $this->module = \ebidlh\Module::getInstance(); $this->pub = \Yii::createObject(['class' => \ebidlh\Redis::className(), 'hostname' => $this->module->redis_server]); $this->sub = \Yii::createObject(['class' => \ebidlh\Redis::className(), 'hostname' => $this->module->redis_server]); }
/** * Initializes the object */ public function init() { parent::init(); if (substr($this->iniDirectory, 0, 1) === '@') { $this->iniDirectory = Yii::getAlias($this->iniDirectory); } }
public function init() { parent::init(); if (empty($this->_list)) { $this->_list = ['@nullref/cms/views/layouts/clear' => Yii::t('cms', 'Base layout')]; } }
public function init() { parent::init(); if (!$this->executePath) { $this->executePath = \Yii::getAlias('@app'); } }
/** * @inheritdoc */ public function init() { parent::init(); if (!isset(Yii::$app->params['languages'])) { throw new \yii\base\InvalidConfigException("You must define Yii::\$app->params['languages'] array"); } foreach (Yii::$app->params['languages'] as $code => $language) { if (is_array($language)) { $this->_languages[$code] = $language; } else { $this->_languages[$code] = ['queryValue' => $language, 'cookieValue' => $language, 'sessionValue' => $language]; } } $queryValue = Yii::$app->request->get($this->queryParam); $cookieValue = Yii::$app->request->cookies->getValue($this->cookieParam); $sessionValue = Yii::$app->session->get($this->sessionParam); if ($queryValue !== null) { $code = $this->getCode('queryValue', $queryValue); $config = ['name' => $this->cookieParam, 'value' => $this->_languages[$code]['cookieValue'], 'expire' => time() + 365 * 24 * 60 * 60]; $config = array_merge($config, $this->cookieParams); Yii::$app->response->cookies->add(new Cookie($config)); Yii::$app->session->set($this->sessionParam, $this->_languages[$code]['sessionValue']); Yii::$app->language = $code; } elseif ($cookieValue !== null && $cookieValue !== $sessionValue) { $code = $this->getCode('cookieValue', $cookieValue); Yii::$app->session->set($this->sessionParam, $this->_languages[$code]['sessionValue']); Yii::$app->language = $code; } elseif ($sessionValue !== null) { $code = $this->getCode('sessionValue', $sessionValue); Yii::$app->language = $code; } }
public function init() { parent::init(); $this->module = \kepco\Module::getInstance(); $this->client = new \GuzzleHttp\Client(['base_uri' => 'http://srm.kepco.net/', 'cookies' => true, 'allow_redirects' => false, 'headers' => ['User-Agent' => 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36', 'Cookie' => $this->cookie, 'X-CSRF-TOKEN' => $this->token]]); $this->sub = \Yii::createObject(['class' => \kepco\Redis::className(), 'hostname' => $this->module->redis_server]); }
public function init() { parent::init(); if ($this->key === null || $this->api === null || $this->appid === null) { throw new InvalidConfigException('UCenter Client appid、api地址、key必须设置,这些参数可以在Ucenter后台-应用设置中查找'); } }
/** * * */ public function init() { if ($this->OpcTabModelClass === null) { throw new InvalidConfigException('Orcsis::OpcTabModelClass must be set.'); } parent::init(); }
/** * @inheritdoc */ public function init() { parent::init(); if (!isset($this->sourcePath) || !isset($this->sourceUrl)) { throw new \yii\base\InvalidConfigException('Invalid sourcePath/sourceUrl.'); } if (!isset($this->thumbsPath) || !isset($this->thumbsUrl)) { $this->thumbsPath = '@app/web/thumbs'; $this->thumbsUrl = '@web/thumbs'; } if (isset($this->text)) { if (!isset($this->text['text']) || !isset($this->text['fontFile'])) { throw new \yii\base\InvalidConfigException('Invalid text.'); } } $this->sourcePath = Yii::getAlias($this->sourcePath); $this->sourceUrl = Yii::getAlias($this->sourceUrl); $this->thumbsPath = Yii::getAlias($this->thumbsPath); $this->thumbsUrl = Yii::getAlias($this->thumbsUrl); $this->sourcePath = str_replace('\\', '/', $this->sourcePath); $this->thumbsPath = str_replace('\\', '/', $this->thumbsPath); if (!isset($this->resizeMode)) { $this->resizeMode = ManipulatorInterface::THUMBNAIL_OUTBOUND; } }
/** * Initializes the application component. * This method overrides the parent implementation by setting default cache key prefix. */ public function init() { parent::init(); if ($this->keyPrefix === null) { $this->keyPrefix = substr(md5(Yii::$app->id), 0, 5); } }
public function init() { parent::init(); //Mandatory config parameters if (!$this->_projectId) { throw new InvalidConfigException('ProjectId cannot be empty!'); } else { $this->configArray['project_id'] = $this->_projectId; } if (!$this->_token) { throw new InvalidConfigException('WriteKey cannot be empty!'); } else { $this->configArray['token'] = $this->_token; } //Optional config parameters if ($this->_protocol !== null) { $this->configArray['protocol'] = $this->_protocol; } if ($this->_host !== null) { $this->configArray['host'] = $this->_host; } if ($this->_port !== null) { $this->configArray['port'] = $this->_port; } if ($this->_protocol !== null) { $this->configArray['api_version'] = $this->_apiVersion; } //Create a new IronMQ object if it hasn't already been created if ($this->_ironmq === null) { $this->_ironmq = new \IronMQ\IronMQ($this->configArray); } }
public function init() { parent::init(); if ($this->modulename == null) { throw new InvalidParamException('modulename parameter for plathir\\settings\\components cannot set.'); } }
/** * Initializes this component. */ public function init() { parent::init(); if ($this->sourceLanguage === null) { $this->sourceLanguage = Yii::$app->sourceLanguage; } }
/** * Initializes a new event tracker object. * * @throws InvalidConfigException If invalid configurations are set. */ public function init() { parent::init(); if (null === $this->types_config || null === $this->keys_config) { throw new InvalidConfigException('Both $types_config and $keys_config should be set for the EventTracker'); } $event_types_instance = Yii::createObject($this->types_config); if (!$event_types_instance instanceof BaseEventTypes) { throw new InvalidConfigException('$types_config should indicate a class subclassing BaseEventTypes to specify the event types.'); } $state_keys_instance = Yii::createObject($this->keys_config); if (!$state_keys_instance instanceof BaseStateKeys) { throw new InvalidConfigException('$keys_config should indicate a class subclassing BaseStateKeys to specify the state keys.'); } $this->_state_keys = $state_keys_instance; $this->_event_types = $event_types_instance; $this->db = Instance::ensure($this->db, Connection::className()); if (null !== $this->post_event_handler) { $handler = Yii::createObject($this->post_event_handler); if (!$handler instanceof PostEventInterface) { throw new InvalidConfigException('$post_event_handler should indicate a class implementing the PostEventInterface.'); } $this->_post_event_handler = $handler; } EventTrackerEvent::$db = $this->db; EventTrackerEvent::$table = $this->event_table; }
public function init() { parent::init(); if (!$this->time instanceof \DateTime) { throw new \yii\base\InvalidConfigException('AbstractTask::$time must be an instance of \\DateTime.'); } }
public function init() { parent::init(); //Merge main extension config with local extension config $config = (include dirname(__FILE__) . '/config/main.php'); foreach ($config as $key => $value) { if (is_array($value)) { $this->{$key} = ArrayHelper::merge($value, $this->{$key}); } elseif (null === $this->{$key}) { $this->{$key} = $value; } } if (Yii::$app instanceof Application) { //Merge commands map Yii::$app->controllerMap = ArrayHelper::merge($this->commandMap, Yii::$app->controllerMap); Yii::$app->controllerMap = array_filter(Yii::$app->controllerMap); } Yii::$app->setComponents($this->components); //Set components if (count($this->components)) { $exists = Yii::$app->getComponents(false); foreach ($this->components as $component => $params) { if (isset($exists[$component]) && is_object($exists[$component])) { unset($this->components[$component]); } elseif (isset($exists[$component])) { $this->components[$component] = ArrayHelper::merge($params, $exists[$component]); } } Yii::$app->setComponents($this->components, false); } Yii::setAlias('@yiicod', realpath(dirname(__FILE__) . '/..')); }
/** * Init */ public function init() { if ($this->path === null) { $this->setPath(); } parent::init(); }
public function init() { parent::init(); if (!isset($this->imagine)) { $this->imagine = $this->createImagine(); } }
public function init() { parent::init(); $this->_api = new \Clickatell\Api\ClickatellHttp($this->username, $this->password, $this->apiID); $this->_api->secure($this->secure); $this->setExtraParameters(); }
public function init() { parent::init(); if ($this->storeInSession) { $this->loadFromSession(); } }
/** * Initializes the application component. */ public function init() { parent::init(); if ($this->identityClass === null) { throw new InvalidConfigException('User::identityClass must be set.'); } }
/** * @inheritdoc */ public function init() { parent::init(); if (Yii::$app->user->isGuest) { throw new ErrorException('is guest'); } }
/** * @inheritdoc */ public function init() { parent::init(); if (!empty($this->preLoad)) { $this->load($this->preLoad); } }
/** * @inheritDoc */ public function init() { parent::init(); if (!$this->client) { throw new InvalidConfigException(\Yii::t('yii', 'AMQP client should be specified')); } if ($this->name) { $this->queueName = $this->queueName ?: $this->name; $this->exchangeName = $this->exchangeName ?: $this->name; } if (!$this->exchangeName) { throw new InvalidConfigException(\Yii::t('yii', 'Exchange name should be specified')); } if (!$this->queueName) { throw new InvalidConfigException(\Yii::t('yii', 'Queue name should be specified')); } if (!$this->client->isConnected()) { $this->client->connect(); } $this->channel = $this->client->newChannel(); $this->exchange = $this->client->newExchange($this->channel, $this->messageType); $this->queue = $this->client->newQueue($this->channel, $this->messageType); $this->exchange->setName($this->exchangeName); $this->exchange->setFlags($this->exchangeFlags); $this->exchange->setType($this->exchangeType); $this->exchange->declareExchange(); $this->queue->setName($this->queueName); $this->queue->setFlags($this->queueFlags); $this->queue->declareQueue(); $this->queue->bind($this->exchange, $this->routingKey, $this->queueBindArguments); }
public function init() { parent::init(); $this->types = yii\helpers\ArrayHelper::merge($this->defaultTypes, $this->types); // pre-init string $this->types['string'] = Yii::createObject($this->types['string']); }
/** * Initialize the component * * @throws \yii\base\InvalidConfigException */ public function init() { parent::init(); if (is_string($this->cache)) { $this->cache = Yii::$app->get($this->cache, false); } }
public function init() { if (!Yii::$app->user->isGuest) { $this->checkMappingDuration(); } parent::init(); }