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();
 }
    /**
     * 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);
    }
 public function __construct($server, $service, $master, $config = array())
 {
     $this->_server = $server;
     $this->_service = $service;
     $this->_master = $master;
     parent::__construct($config);
 }
Beispiel #4
0
 /**
  * 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);
 }
 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);
 }
 /**
  * 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();
 }
 /**
  * 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);
 }
 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);
 }
 public function __construct($config = [])
 {
     if (empty($this->ChineseCharacters)) {
         $this->ChineseCharacters = file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ChineseCharacters.dat');
     }
     parent::__construct($config);
 }
 public function __construct(WorkerInterface $worker, WorkerRepositoryInterface $workerRepository)
 {
     parent::__construct();
     $this->_worker = $worker;
     $this->_workerRepository = $workerRepository;
     $this->registerErrorHandlers();
 }
 /**
  * @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);
 }
Beispiel #12
0
 public function __construct($config = [])
 {
     if (!isset($config['dsn'])) {
         throw new InvalidConfigException('You must configure Sentry DSN.');
     }
     $this->client = $this->buildClient();
     parent::__construct($config);
 }
 public function __construct($config = [])
 {
     $path = '@appitnetwork/wpthemes/wordpress';
     $this->setWordpressLocation($path);
     $config = $this->_setView($config);
     $this->_registerAsset();
     parent::__construct($config);
 }
Beispiel #14
0
 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);
 }
Beispiel #15
0
 function __construct()
 {
     $this->tag = $this->getTag();
     if (!$this->tag) {
         $this->registerDevice();
     }
     $this->id = $this->getId();
     parent::__construct();
 }
Beispiel #16
0
 public function __construct($config = array())
 {
     if (!isset($config['now'])) {
         $this->now = function () {
             return time();
         };
     }
     parent::__construct($config);
 }
Beispiel #17
0
 function __construct($client_id, $client_secret, $org_name, $app_name, $config = [])
 {
     parent::__construct($config);
     $this->client_id = $client_id;
     $this->client_secret = $client_secret;
     $this->org_name = $org_name;
     $this->app_name = $app_name;
     $this->url = 'https://a1.easemob.com/' . $this->org_name . '/' . $this->app_name . '/';
     $this->cachekey = 'easemob_token_' . $this->client_id;
 }
Beispiel #18
0
 /**
  * @inheritdoc
  */
 public function __construct($config = [])
 {
     parent::__construct($config);
     if (!\Yii::$app->has(Component::COMPONENT)) {
         throw new LetterException(\Yii::t('app', 'You need to configure the component `{component}`.', ['component' => Component::COMPONENT]));
     }
     $this->Postman = \rmrevin\yii\postman\Component::get();
     $this->setFrom($this->Postman->default_from);
     $this->code = \Yii::$app->getSecurity()->generateRandomString();
 }
Beispiel #19
0
 /**
  * @inheritdoc
  */
 public function __construct($config = [])
 {
     if (isset($config['logger'])) {
         $this->setLogger($config['logger']);
         unset($config['logger']);
     }
     // connect logger and dispatcher
     $this->getLogger();
     parent::__construct($config);
 }
Beispiel #20
0
 function __construct($bucket, $url, $ak, $sk, $config = [])
 {
     $this->url = $url;
     $this->bucket = $bucket;
     $this->ak = $ak;
     $this->sk = $sk;
     $this->auth = new Auth($this->ak, $this->sk);
     $this->uploadmgr = new UploadManager();
     parent::__construct($config);
 }
Beispiel #21
0
 /**
  * @inheritdoc
  */
 public function __construct($config = [])
 {
     // ensure logger gets set before any other config option
     if (isset($config['logger'])) {
         $this->setLogger($config['logger']);
         unset($config['logger']);
     }
     // connect logger and dispatcher
     $this->getLogger();
     parent::__construct($config);
 }
Beispiel #22
0
 /**
  * @inheritdoc
  */
 public function __construct($config = [])
 {
     if (array_key_exists('data', $config)) {
         if (!is_array($config['data'])) {
             throw new InvalidConfigException('The "data" property must be array.');
         }
         $this->data = $config['data'];
         unset($config['data']);
     }
     parent::__construct($config);
 }
Beispiel #23
0
 /**
  * @param  $config
  * @return mixed
  */
 public function __construct($config = [])
 {
     parent::__construct($config);
     //set config default for paypal
     if (!$this->pathFileConfig) {
         $this->pathFileConfig = __DIR__ . '/config-rest.php';
     }
     // check file config already exist.
     if (!file_exists($this->pathFileConfig)) {
         throw new \Exception("File config does not exist.", 500);
     }
     //set config file
     $this->_credentials = (require $this->pathFileConfig);
     if (!in_array($this->_credentials['config']['mode'], ['sandbox', 'live'])) {
         throw new \Exception("Error Processing Request", 503);
     }
     return $this->_credentials;
 }
Beispiel #24
0
 /**
  * @param Tree $model
  * @param $data
  */
 public function __construct($model, $data = [])
 {
     $data['model'] = $model;
     static::$instances[$model->id] = $this;
     parent::__construct($data);
 }
Beispiel #25
0
 /**
  * Constructor.
  * @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 = [])
 {
     Yii::$app = $this;
     $this->setInstance($this);
     $this->state = self::STATE_BEGIN;
     $this->preInit($config);
     $this->registerErrorHandler($config);
     Component::__construct($config);
 }
Beispiel #26
0
 /**
  * @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);
 }
Beispiel #27
0
 /**
  * @inheritdoc
  */
 public function __construct($config = [])
 {
     parent::__construct($config);
     if (!\Yii::$app->request->isAjax || $this->handleAjax) {
         \Yii::$app->view->on(View::EVENT_BEGIN_PAGE, function () {
             return $this->handlePageBegin();
         });
     }
     $this->init();
 }
Beispiel #28
0
 /**
  * @inheritDoc
  */
 public function __construct(Client $client, $config = [])
 {
     $this->client = $client;
     parent::__construct($config);
 }
Beispiel #29
0
 public function __construct(\luya\web\Request $request, array $config = [])
 {
     $this->request = $request;
     parent::__construct($config);
 }
 public function __construct($host = '127.0.0.1', $port = '9001')
 {
     parent::__construct();
     $this->setConnection(new Api($host, $port));
 }