当前位置: 首页>>代码示例>>PHP>>正文


PHP Component::__construct方法代码示例

本文整理汇总了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();
 }
开发者ID:giantbits,项目名称:yii2-crelish,代码行数:33,代码来源:CrelishJsonDataProvider.php

示例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);
    }
开发者ID:aryangomes,项目名称:applanchonete,代码行数:16,代码来源:SeriesDataHelper.php

示例3: __construct

 public function __construct($server, $service, $master, $config = array())
 {
     $this->_server = $server;
     $this->_service = $service;
     $this->_master = $master;
     parent::__construct($config);
 }
开发者ID:crashkita,项目名称:yii2-websocket,代码行数:7,代码来源:WebsocketService.php

示例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);
 }
开发者ID:glcode,项目名称:yii2-2.0.3-annotated,代码行数:14,代码来源:Action.php

示例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);
 }
开发者ID:GAMITG,项目名称:yii2-geolocation,代码行数:27,代码来源:Geolocation.php

示例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();
 }
开发者ID:HEXA-UA,项目名称:supervisor-manager,代码行数:13,代码来源:Connection.php

示例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);
 }
开发者ID:HEXA-UA,项目名称:supervisor-manager,代码行数:14,代码来源:ConfigFileHandler.php

示例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);
 }
开发者ID:indicalabs,项目名称:yii2-geolocation,代码行数:27,代码来源:Geolocation.php

示例9: __construct

 public function __construct($config = [])
 {
     if (empty($this->ChineseCharacters)) {
         $this->ChineseCharacters = file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ChineseCharacters.dat');
     }
     parent::__construct($config);
 }
开发者ID:hhy5861,项目名称:yii2-chinese-transform-pinyin,代码行数:7,代码来源:ChineseTransformPinyin.php

示例10: __construct

 public function __construct(WorkerInterface $worker, WorkerRepositoryInterface $workerRepository)
 {
     parent::__construct();
     $this->_worker = $worker;
     $this->_workerRepository = $workerRepository;
     $this->registerErrorHandlers();
 }
开发者ID:entityfx,项目名称:yii2-utils,代码行数:7,代码来源:WorkerInterceptor.php

示例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);
 }
开发者ID:glcode,项目名称:yii2-2.0.3-annotated,代码行数:12,代码来源:Controller.php

示例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);
 }
开发者ID:asasmoyo,项目名称:yii2-sentry,代码行数:8,代码来源:Sentry.php

示例13: __construct

 public function __construct($config = [])
 {
     $path = '@appitnetwork/wpthemes/wordpress';
     $this->setWordpressLocation($path);
     $config = $this->_setView($config);
     $this->_registerAsset();
     parent::__construct($config);
 }
开发者ID:AppItNetwork,项目名称:yii2-wordpress-themes,代码行数:8,代码来源:WPT.php

示例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);
 }
开发者ID:code-on-yii,项目名称:yii2-sms,代码行数:9,代码来源:Sms.php

示例15:

 function __construct()
 {
     $this->tag = $this->getTag();
     if (!$this->tag) {
         $this->registerDevice();
     }
     $this->id = $this->getId();
     parent::__construct();
 }
开发者ID:asakasinsky,项目名称:yii2-cart,代码行数:9,代码来源:Device.php


注:本文中的yii\base\Component::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。