當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。