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


PHP base\Object类代码示例

本文整理汇总了PHP中yii\base\Object的典型用法代码示例。如果您正苦于以下问题:PHP Object类的具体用法?PHP Object怎么用?PHP Object使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Object类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 /**
  *
  */
 public function init()
 {
     parent::init();
     if ($this->placeholder) {
         $this->placeholder = Yii::createObject($this->placeholder);
     }
 }
开发者ID:voodoo-mobile,项目名称:yii2-image,代码行数:10,代码来源:ImageAttributeDescriptor.php

示例2: run

 /**
  * @return string
  * @throws NotAcceptableHttpException
  */
 public function run()
 {
     if (!Yii::$app->request->isAjax) {
         throw new NotAcceptableHttpException('This action AJAX only!');
     }
     $post = Yii::$app->request->post();
     $keys = array_keys($post);
     $formName = $keys[0];
     if (!isset($post[$formName][$this->textFormatField])) {
         throw new InvalidParamException('Invalid POST data.');
     }
     $format = $post[$formName][$this->textFormatField];
     $text = $post[$formName][$this->textField];
     if ($this->context === null) {
         $this->context = Yii::$app->controller;
         if (!$this->context->canGetProperty('textFormats') || !$this->context->canGetProperty('textEditorWidgetOptions')) {
             $this->context = Yii::$app->controller->module;
         }
     }
     if (!$this->context->canGetProperty('textFormats') || !$this->context->canGetProperty('textEditorWidgetOptions')) {
         throw new InvalidParamException('Invalid context. Add TextFormatsBehavior to module.');
     }
     $formats = $this->context->textFormats;
     if (!isset($formats[$format])) {
         throw new InvalidParamException('Format not found.');
     }
     $params = ['fieldName' => $formName . '[' . $this->textField . ']', 'text' => $text, 'formatInfo' => $formats[$format], 'widgetOptions' => $this->context->textEditorWidgetOptions];
     if ($this->view) {
         return $this->controller->renderAjax($this->view, $params);
     } else {
         return $this->controller->renderAjax('@vendor/maddoger/yii2-textformats/views/changeFormat.php', $params);
     }
 }
开发者ID:maddoger,项目名称:yii2-textformats,代码行数:37,代码来源:ChangeFormatAction.php

示例3: __get

 public function __get($name)
 {
     if (isset($this->_user[$name])) {
         return $this->_user[$name];
     }
     return parent::__get($name);
 }
开发者ID:weiyiyi,项目名称:base,代码行数:7,代码来源:UserIdentity.php

示例4: init

 public function init()
 {
     parent::init();
     if (!empty($this->fileHash)) {
         $this->fileInfo = FileInfo::findOne(['hash' => $this->fileHash]);
     }
 }
开发者ID:JiltImageBoard,项目名称:jilt-backend,代码行数:7,代码来源:PostedFile.php

示例5: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->href === null) {
         throw new InvalidConfigException('The href attribute can not be empty and must be set trough configuration array.');
     }
 }
开发者ID:luyadev,项目名称:luya-core,代码行数:10,代码来源:ExternalLink.php

示例6: __construct

 /**
  * @param \phpDocumentor\Reflection\BaseReflector $reflector
  * @param Context $context
  * @param array $config
  */
 public function __construct($reflector = null, $context = null, $config = [])
 {
     parent::__construct($config);
     if ($reflector === null) {
         return;
     }
     // base properties
     $this->name = ltrim($reflector->getName(), '\\');
     $this->startLine = $reflector->getNode()->getAttribute('startLine');
     $this->endLine = $reflector->getNode()->getAttribute('endLine');
     $docblock = $reflector->getDocBlock();
     if ($docblock !== null) {
         $this->shortDescription = ucfirst($docblock->getShortDescription());
         if (empty($this->shortDescription) && !$this instanceof PropertyDoc && $context !== null && $docblock->getTagsByName('inheritdoc') === null) {
             $context->errors[] = ['line' => $this->startLine, 'file' => $this->sourceFile, 'message' => "No short description for " . substr(StringHelper::basename(get_class($this)), 0, -3) . " '{$this->name}'"];
         }
         $this->description = $docblock->getLongDescription()->getContents();
         $this->phpDocContext = $docblock->getContext();
         $this->tags = $docblock->getTags();
         foreach ($this->tags as $i => $tag) {
             if ($tag instanceof SinceTag) {
                 $this->since = $tag->getVersion();
                 unset($this->tags[$i]);
             } elseif ($tag instanceof DeprecatedTag) {
                 $this->deprecatedSince = $tag->getVersion();
                 $this->deprecatedReason = $tag->getDescription();
                 unset($this->tags[$i]);
             }
         }
     } elseif ($context !== null) {
         $context->errors[] = ['line' => $this->startLine, 'file' => $this->sourceFile, 'message' => "No docblock for element '{$this->name}'"];
     }
 }
开发者ID:136216444,项目名称:yii2-apidoc,代码行数:38,代码来源:BaseDoc.php

示例7: init

 /**
  * @inheritdoc
  * @throws \yii\base\InvalidConfigException
  */
 public function init()
 {
     if ($this->name === null) {
         throw new InvalidConfigException("'name' cannot be null.");
     }
     parent::init();
 }
开发者ID:awebc,项目名称:web_xbf,代码行数:11,代码来源:Bloodhound.php

示例8: init

 public function init()
 {
     parent::init();
     if (!(!empty($this->url) xor !empty($this->content))) {
         throw new \yii\base\InvalidConfigException("Url or Content must be exsit one");
     }
 }
开发者ID:itzj86,项目名称:yii2-dwz,代码行数:7,代码来源:Tab.php

示例9: init

 /**
  * {@inheritdoc}
  */
 public function init()
 {
     parent::init();
     if (is_null($this->remote)) {
         throw new InvalidConfigException('$remote must be set.');
     }
 }
开发者ID:lxpgw,项目名称:logger,代码行数:10,代码来源:Pubu.php

示例10: __get

 public function __get($property)
 {
     if ($this->isNestedProperty($property)) {
         return $this->getNestedProperty($property);
     }
     return parent::__get($property);
 }
开发者ID:tsamsiyu,项目名称:yii2-over,代码行数:7,代码来源:ModelBase.php

示例11: init

 public function init()
 {
     $this->_error = true;
     $this->_message = [];
     $this->_format = \yii\web\Response::FORMAT_JSON;
     return parent::init();
 }
开发者ID:spiro-stathakis,项目名称:projects,代码行数:7,代码来源:AjaxResponse.php

示例12: init

 public function init()
 {
     if (!yii::$app->user->isGuest) {
         $this->_userId = yii::$app->user->id;
     }
     return parent::init();
 }
开发者ID:spiro-stathakis,项目名称:projects,代码行数:7,代码来源:SecurityComponent.php

示例13: init

 public function init()
 {
     parent::init();
     $configFile = Yii::getAlias($this->configFileName);
     $this->config = (require $configFile);
     $this->instance = new \OneLogin_Saml2_Auth($this->config);
 }
开发者ID:asasmoyo,项目名称:yii2-saml,代码行数:7,代码来源:Saml.php

示例14: init

 public function init()
 {
     parent::init();
     if (!isset($this->key)) {
         throw new InvalidConfigException('JWPlayer: License key missing!');
     }
 }
开发者ID:wadeshuler,项目名称:yii2-jwplayer,代码行数:7,代码来源:JWConfig.php

示例15: __construct

 /**
  * @param string|mixed[] $config the configuration of [[\romkaChev\yii2\swiper\Slide]]
  *                               You can create slide just from string
  *                               For example:
  *
  *                               ~~~
  *                                 $slide = new \romkaChev\yii2\swiper\Slide('slide content');
  *                               ~~~
  *
  *
  *                               Also you can create slide from array or strings and
  *                               they will be merged into one string
  *                               For example:
  *
  *                               ~~~
  *                                $slide = new \romkaChev\yii2\swiper\Slide([
  *                                    'content' => [
  *                                        '<h1>Title</h1>',
  *                                        '<h3>Subtitle</h3>',
  *                                        '<p>Main content</p>'
  *                                    ]
  *                                ]);
  *                               ~~~
  *
  * @see \romkaChev\yii2\swiper\Slide::$background
  * @see \romkaChev\yii2\swiper\Slide::$hash
  * @see \romkaChev\yii2\swiper\Slide::$content
  */
 public function __construct($config = [])
 {
     $config = is_string($config) ? [self::CONTENT => $config] : $config;
     $config[self::CONTENT] = ArrayHelper::getValue($config, self::CONTENT, null);
     $config[self::CONTENT] = is_array($config[self::CONTENT]) ? implode('', $config[self::CONTENT]) : $config[self::CONTENT];
     parent::__construct($config);
 }
开发者ID:romka-chev,项目名称:yii2-swiper,代码行数:35,代码来源:Slide.php


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