當前位置: 首頁>>代碼示例>>PHP>>正文


PHP base\Component類代碼示例

本文整理匯總了PHP中yii\base\Component的典型用法代碼示例。如果您正苦於以下問題:PHP Component類的具體用法?PHP Component怎麽用?PHP Component使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Component類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: triggerComponentEvent

 public function triggerComponentEvent($name, Event $event, Component $component)
 {
     if ($component === null) {
         return;
     }
     $component->trigger($name, $event);
 }
開發者ID:entityfx,項目名稱:yii2-utils,代碼行數:7,代碼來源:ComponentBase.php

示例2: validate

 /**
  * @param Component $component
  * @return \skeeks\sx\validate\Result
  */
 public function validate($component)
 {
     if (!$component instanceof ActiveRecord) {
         return $this->_bad(\Yii::t('app', "Object: {class} must be inherited from: {parent}", ['class' => $component->className(), 'parent' => ActiveRecord::className()]));
     }
     return !$component->isNewRecord ? $this->_ok() : $this->_bad(\Yii::t('app', "The object must already be saved"));
 }
開發者ID:Liv1020,項目名稱:cms,代碼行數:11,代碼來源:NotNewRecord.php

示例3: behavior

 /**
  * Getting behavior object from given model
  *
  * @param Component $model
  * @return SeoBehavior
  * @throws InvalidConfigException if model don't have our SeoBehavior
  */
 protected static function behavior(Component $model)
 {
     foreach ($model->getBehaviors() as $b) {
         if ($b instanceof SeoBehavior) {
             return $b;
         }
     }
     throw new InvalidConfigException('Model ' . $model->className() . ' must have SeoBehavior');
 }
開發者ID:romi45,項目名稱:yii2-seo-behavior,代碼行數:16,代碼來源:SeoContentHelper.php

示例4: attachSupportBehaviors

 protected function attachSupportBehaviors(Component $owner)
 {
     $rangeAttributes = [];
     foreach ($this->attributes as $attribute => $dbAttribute) {
         $rangeAttributes[] = $attribute . '_start';
         $rangeAttributes[] = $attribute . '_end';
         $owner->attachBehavior(0, ['class' => DateTimeRangeBehavior::class, 'startAttribute' => $attribute . '_start_local', 'endAttribute' => $attribute . '_end_local', 'targetAttribute' => $attribute . '_range']);
     }
     $owner->attachBehavior(0, ['class' => DateTimeBehavior::class, 'originalFormat' => ['date', 'yyyy-MM-dd'], 'targetFormat' => ['date', 'dd.MM.yyyy'], 'attributes' => $rangeAttributes]);
 }
開發者ID:omnilight,項目名稱:yz2-admin,代碼行數:10,代碼來源:DateRangeFilteringBehavior.php

示例5: init

 public function init()
 {
     parent::init();
     //Merge main extension config with local extension config
     $config = (include dirname(__FILE__) . '/config/main.php');
     foreach ($config as $key => $value) {
         if (is_array($value)) {
             $this->{$key} = ArrayHelper::merge($value, $this->{$key});
         } elseif (null === $this->{$key}) {
             $this->{$key} = $value;
         }
     }
     if (Yii::$app instanceof Application) {
         //Merge commands map
         Yii::$app->controllerMap = ArrayHelper::merge($this->commandMap, Yii::$app->controllerMap);
         Yii::$app->controllerMap = array_filter(Yii::$app->controllerMap);
     }
     Yii::$app->setComponents($this->components);
     //Set components
     if (count($this->components)) {
         $exists = Yii::$app->getComponents(false);
         foreach ($this->components as $component => $params) {
             if (isset($exists[$component]) && is_object($exists[$component])) {
                 unset($this->components[$component]);
             } elseif (isset($exists[$component])) {
                 $this->components[$component] = ArrayHelper::merge($params, $exists[$component]);
             }
         }
         Yii::$app->setComponents($this->components, false);
     }
     Yii::setAlias('@yiicod', realpath(dirname(__FILE__) . '/..'));
 }
開發者ID:yiicod,項目名稱:yii2-mailqueue,代碼行數:32,代碼來源:MailQueue.php

示例6: init

 public function init()
 {
     parent::init();
     if (!$this->executePath) {
         $this->executePath = \Yii::getAlias('@app');
     }
 }
開發者ID:nagser,項目名稱:base,代碼行數:7,代碼來源:ConsoleManager.php

示例7: init

 public function init()
 {
     parent::init();
     if (Yii::$app->view !== null) {
         Yii::$app->view->on(yii\web\View::EVENT_BEGIN_PAGE, [$this, 'eventSetMeta']);
     }
 }
開發者ID:shershennm,項目名稱:yii2-seo,代碼行數:7,代碼來源:Seo.php

示例8: init

 public function init()
 {
     parent::init();
     $this->module = \kepco\Module::getInstance();
     $this->client = new \GuzzleHttp\Client(['base_uri' => 'http://srm.kepco.net/', 'cookies' => true, 'allow_redirects' => false, 'headers' => ['User-Agent' => 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36', 'Cookie' => $this->cookie, 'X-CSRF-TOKEN' => $this->token]]);
     $this->sub = \Yii::createObject(['class' => \kepco\Redis::className(), 'hostname' => $this->module->redis_server]);
 }
開發者ID:didwjdgks,項目名稱:yii2-kepco,代碼行數:7,代碼來源:Http.php

示例9: __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

示例10: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!empty($this->preLoad)) {
         $this->load($this->preLoad);
     }
 }
開發者ID:rafalkot,項目名稱:yii2-settings,代碼行數:10,代碼來源:Settings.php

示例11: init

 public function init()
 {
     parent::init();
     if ($this->storeInSession) {
         $this->loadFromSession();
     }
 }
開發者ID:andreosoft,項目名稱:andreocms,代碼行數:7,代碼來源:Cart.php

示例12: init

 public function init()
 {
     parent::init();
     $this->_api = new \Clickatell\Api\ClickatellHttp($this->username, $this->password, $this->apiID);
     $this->_api->secure($this->secure);
     $this->setExtraParameters();
 }
開發者ID:albertborsos,項目名稱:yii2-clickatell,代碼行數:7,代碼來源:ClickatellHttp.php

示例13: init

 /**
  * Initializes the application component.
  */
 public function init()
 {
     parent::init();
     if ($this->identityClass === null) {
         throw new InvalidConfigException('User::identityClass must be set.');
     }
 }
開發者ID:hhy5861,項目名稱:yii2-ticket,代碼行數:10,代碼來源:AuthApi.php

示例14: init

 /**
  * Init
  */
 public function init()
 {
     if ($this->path === null) {
         $this->setPath();
     }
     parent::init();
 }
開發者ID:yiimediafile,項目名稱:mediafile,代碼行數:10,代碼來源:File.php

示例15: init

 public function init()
 {
     parent::init();
     if (!$this->time instanceof \DateTime) {
         throw new \yii\base\InvalidConfigException('AbstractTask::$time must be an instance of \\DateTime.');
     }
 }
開發者ID:iw-reload,項目名稱:iw,代碼行數:7,代碼來源:AbstractTask.php


注:本文中的yii\base\Component類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。