本文整理汇总了PHP中yii\base\Component::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::__construct方法的具体用法?PHP Component::__construct怎么用?PHP Component::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\base\Component
的用法示例。
在下文中一共展示了Component::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($ctype, $settings = [], $uuid = null)
{
$this->ctype = $ctype;
$this->pathAlias = $this->ctype == 'elements' ? '@app/workspace' : '@app/workspace/data';
if (!empty($uuid)) {
$this->uuid = $uuid;
if ($theFile = @file_get_contents($this->resolveDataSource($uuid))) {
$this->allModels[] = $this->processSingle(\yii\helpers\Json::decode($theFile), true);
} else {
$this->allModels[] = [];
}
} else {
$dataModels = \Yii::$app->cache->get('crc_' . $ctype);
if ($dataModels === false) {
// $data is not found in cache, calculate it from scratch
$dataModels = $this->parseFolderContent($this->ctype);
// store $data in cache so that it can be retrieved next time
\Yii::$app->cache->set('crc_' . $ctype, $dataModels);
}
$this->allModels = $dataModels;
}
if (Arrays::has($settings, 'filter')) {
if (!empty($settings['filter'])) {
$this->filterModels($settings['filter']);
}
}
if (Arrays::has($settings, 'sort')) {
if (!empty($settings['sort'])) {
$this->sortModels($settings['sort']);
}
}
parent::__construct();
}
示例2: __construct
/**
* Constructor
*
* @param BaseDataProvider|array $data the underlying data source
* @param array $columns column configuration
* @param array $config for future use
* @see setColumns()
* @see setData()
*/
public function __construct($data, $columns, $config = [])
{
parent::__construct($config);
$this->setData($data);
$this->setColumns($columns);
}
示例3: __construct
public function __construct($server, $service, $master, $config = array())
{
$this->_server = $server;
$this->_service = $service;
$this->_master = $master;
parent::__construct($config);
}
示例4: __construct
/**
* 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 = [])
{
// 传入action的id和所属controller的实例
$this->id = $id;
$this->controller = $controller;
parent::__construct($config);
}
示例5: __construct
public function __construct($config = array())
{
self::$plugins = array_diff(scandir(__DIR__ . '/plugins/'), array('..', '.'));
if (isset($config['config']['provider'])) {
$provider = $config['config']['provider'];
if (in_array($provider . ".php", self::$plugins)) {
require __DIR__ . '/plugins/' . $provider . '.php';
if (isset($config['config']['return_format'])) {
$format = $config['config']['return_format'];
if (in_array($format, $plugin['accepted_formats'])) {
self::$return_format = $format;
} else {
self::$return_format = $plugin['default_accepted_format'];
}
}
self::$provider = $plugin;
self::$api_key = isset($config['config']['api_key']) ? $config['config']['api_key'] : NULL;
} else {
throw new \yii\web\HttpException(404, 'The requested Item could not be found.');
}
} else {
require __DIR__ . '/plugins/geoplugin.php';
self::$provider = $plugin;
self::$return_format = $plugin['default_accepted_format'];
}
return parent::__construct($config);
}
示例6: __construct
/**
* Connection constructor.
*
* @param XmlRpcClient $client
* @param array $config
*/
public function __construct(XmlRpcClient $client, array $config = [])
{
parent::__construct($config);
$this->_connection = $client;
$this->_initConnection();
$this->checkConnection();
}
示例7: __construct
/**
* ConfigFileHandler constructor.
*
* @param string $processName
* @param string $configDir
* @param array $config
*/
public function __construct($processName = null, $configDir = null, $config = [])
{
$this->_processName = $processName;
$this->_setConfigDir($configDir);
$this->_checkConfigDir();
parent::__construct($config);
}
示例8: __construct
public function __construct($config = array())
{
self::$plugins = array_diff(scandir(__DIR__ . '/plugins/'), array('..', '.'));
$provider = ArrayHelper::getValue($config, 'config.provider');
if (isset($provider)) {
if (ArrayHelper::isIn($provider . '.php', self::$plugins)) {
require __DIR__ . '/plugins/' . $provider . '.php';
$format = ArrayHelper::getValue($config, 'config.return_formats');
if (isset($format)) {
if (ArrayHelper::isIn($format, ArrayHelper::getValue($plugin, 'accepted_formats'))) {
self::$return_formats = $format;
} else {
self::$return_formats = ArrayHelper::getValue($plugin, 'default_accepted_format');
}
}
self::$provider = $plugin;
self::$api_key = ArrayHelper::getValue($config, 'config.api_key', NULL);
} else {
throw new HttpException(404, 'The requested Item could not be found.');
}
} else {
require __DIR__ . '/plugins/geoplugin.php';
self::$provider = $plugin;
self::$return_formats = $plugin['default_accepted_format'];
}
return parent::__construct($config);
}
示例9: __construct
public function __construct($config = [])
{
if (empty($this->ChineseCharacters)) {
$this->ChineseCharacters = file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ChineseCharacters.dat');
}
parent::__construct($config);
}
示例10: __construct
public function __construct(WorkerInterface $worker, WorkerRepositoryInterface $workerRepository)
{
parent::__construct();
$this->_worker = $worker;
$this->_workerRepository = $workerRepository;
$this->registerErrorHandlers();
}
示例11: __construct
/**
* @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 = [])
{
// 传入controller的id和所在的module的实例
$this->id = $id;
$this->module = $module;
parent::__construct($config);
}
示例12: __construct
public function __construct($config = [])
{
if (!isset($config['dsn'])) {
throw new InvalidConfigException('You must configure Sentry DSN.');
}
$this->client = $this->buildClient();
parent::__construct($config);
}
示例13: __construct
public function __construct($config = [])
{
$path = '@appitnetwork/wpthemes/wordpress';
$this->setWordpressLocation($path);
$config = $this->_setView($config);
$this->_registerAsset();
parent::__construct($config);
}
示例14: __construct
public function __construct(ServiceInterface $service = null, array $config = [])
{
if (!empty($config)) {
$this->service = \Yii::createObject($config['serviceClass'], [$config['serviceParams']]);
} else {
$this->service = $service;
}
parent::__construct($config);
}
示例15:
function __construct()
{
$this->tag = $this->getTag();
if (!$this->tag) {
$this->registerDevice();
}
$this->id = $this->getId();
parent::__construct();
}