/** * Initializes this component. */ public function init() { parent::init(); if ($this->sourceLanguage === null) { $this->sourceLanguage = Leaps::$app->sourceLanguage; } }
/** * Initializes the component by configuring the default message categories. */ public function init() { parent::init(); if (!isset($this->translations['leaps']) && !isset($this->translations['leaps*'])) { $this->translations['leaps'] = ['className' => 'Leaps\\I18n\\PhpMessageSource', 'sourceLanguage' => 'en-US', 'basePath' => '@Leaps/Message']; } if (!isset($this->translations['app']) && !isset($this->translations['app*'])) { $this->translations['app'] = ['className' => 'Leaps\\I18n\\PhpMessageSource', 'sourceLanguage' => Leaps::$app->sourceLanguage, 'basePath' => '@app/Message']; } }
/** * Initializes the application component. * This method is required by IApplicationComponent and is invoked by application. */ public function init() { parent::init(); register_shutdown_function([$this, 'close']); }
/** * 初始化 * * @throws InvalidConfigException if [[basePath]] is invalid */ public function init() { parent::init(); $this->basePath = Leaps::getAlias($this->basePath); if (!is_dir($this->basePath)) { throw new InvalidConfigException("The directory does not exist: {$this->basePath}"); } elseif (!is_writable($this->basePath)) { throw new InvalidConfigException("The directory is not writable by the Web process: {$this->basePath}"); } else { $this->basePath = realpath($this->basePath); } $this->baseUrl = rtrim(Leaps::getAlias($this->baseUrl), '/'); }
/** * Initializes the migration. * This method will set [[db]] to be the 'db' application component, if it is `null`. */ public function init() { parent::init(); $this->db = Instance::ensure($this->db, Connection::className()); $this->db->getSchema()->refresh(); }
/** * Initializes UrlManager. */ public function init() { parent::init(); if (!$this->enablePrettyUrl || empty($this->rules)) { return; } if (is_string($this->cache)) { $this->cache = Leaps::$app->get($this->cache, false); } if ($this->cache instanceof Cache) { $cacheKey = __CLASS__; $hash = md5(json_encode($this->rules)); if (($data = $this->cache->get($cacheKey)) !== false && isset($data[1]) && $data[1] === $hash) { $this->rules = $data[0]; } else { $this->rules = $this->buildRules($this->rules); $this->cache->set($cacheKey, [$this->rules, $hash]); } } else { $this->rules = $this->buildRules($this->rules); } }
/** * 初始化 */ public function init() { parent::init(); if ($this->identityClass === null) { throw new InvalidConfigException('User::identityClass must be set.'); } if ($this->enableAutoLogin && !isset($this->identityCookie['name'])) { throw new InvalidConfigException('User::identityCookie must contain the "name" element.'); } }
/** * * @param string $id the ID of this controller. * @param Module $module the module that this controller belongs to. * @param array $config name-value pairs that will be used to initialize the object properties. */ public function __construct($id, $module, $config = []) { $this->id = $id; $this->module = $module; parent::__construct($config); }
/** * Checks if a property value is null. * This method overrides the parent implementation by checking if the named component is loaded. * * @param string $name the property name or the event name * @return boolean whether the property value is null */ public function __isset($name) { if ($this->has($name, true)) { return true; } else { return parent::__isset($name); } }
/** * @inheritdoc */ public function init() { parent::init(); foreach ($this->targets as $name => $target) { if (!$target instanceof Target) { $this->targets[$name] = Leaps::createObject($target); } } }
/** * Constructor. * * @param string $id the ID of this action * @param Controller $controller the controller that owns this action * @param array $config name-value pairs that will be used to initialize the object properties */ public function __construct($id, $controller, $config = []) { $this->id = $id; $this->controller = $controller; parent::__construct($config); }
/** * @inheritdoc */ public function init() { parent::init(); $this->attributes = (array) $this->attributes; $this->on = (array) $this->on; $this->except = (array) $this->except; }
/** * Initializes the logger by registering [[flush()]] as a shutdown function. */ public function init() { parent::init(); register_shutdown_function(function () { // make regular flush before other shutdown functions, which allows session data collection and so on $this->flush(); // make sure log entries written by shutdown functions are also flushed // ensure "flush()" is called last when there are multiple shutdown functions register_shutdown_function([$this, 'flush'], true); }); }
/** * 构造方法 * * @param array $config name-value pairs that will be used to initialize the object properties. * Note that the configuration must contain both [[id]] and [[basePath]]. * @throws InvalidConfigException if either [[id]] or [[basePath]] configuration is missing. */ public function __construct($config = []) { Leaps::$app = $this; $this->setInstance($this); $this->state = self::STATE_BEGIN; $this->preInit($config); $this->registerErrorHandler($config); Service::__construct($config); }
/** * Initializes the view component. */ public function init() { parent::init(); if (is_array($this->theme)) { if (!isset($this->theme['className'])) { $this->theme['className'] = 'Leaps\\Base\\Theme'; } $this->theme = Leaps::createObject($this->theme); } elseif (is_string($this->theme)) { $this->theme = Leaps::createObject($this->theme); } }