php yii-base-Object类(方法)实例源码

下面列出了php yii-base-Object 类(方法)源码代码实例,从而了解它的用法。

作者:voodoo-mobil    项目:yii2-imag   
/**
  *
  */
 public function init()
 {
     parent::init();
     if ($this->placeholder) {
         $this->placeholder = Yii::createObject($this->placeholder);
     }
 }

作者:yurii-githu    项目:yii2-myli   
/**
  * (non-PHPdoc)
  * @see \yii\base\Object::__get()
  */
 public function __get($name)
 {
     if (in_array($name, $this->options)) {
         return $this->config->{$name};
     }
     return parent::__get($name);
 }

作者:maddoge    项目:yii2-textformat   
/**
  * @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);
     }
 }

作者:weiyiy    项目:bas   
public function __get($name)
 {
     if (isset($this->_user[$name])) {
         return $this->_user[$name];
     }
     return parent::__get($name);
 }

作者:JiltImageBoar    项目:jilt-backen   
public function init()
 {
     parent::init();
     if (!empty($this->fileHash)) {
         $this->fileInfo = FileInfo::findOne(['hash' => $this->fileHash]);
     }
 }

作者:luyade    项目:luya-cor   
/**
  * @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.');
     }
 }

作者:13621644    项目:yii2-apido   
/**
  * @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}'"];
     }
 }

作者:aweb    项目:web_xb   
/**
  * @inheritdoc
  * @throws \yii\base\InvalidConfigException
  */
 public function init()
 {
     if ($this->name === null) {
         throw new InvalidConfigException("'name' cannot be null.");
     }
     parent::init();
 }

作者:itzj8    项目:yii2-dw   
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");
     }
 }

作者:lxpg    项目:logge   
/**
  * {@inheritdoc}
  */
 public function init()
 {
     parent::init();
     if (is_null($this->remote)) {
         throw new InvalidConfigException('$remote must be set.');
     }
 }

作者:tsamsiy    项目:yii2-ove   
public function __get($property)
 {
     if ($this->isNestedProperty($property)) {
         return $this->getNestedProperty($property);
     }
     return parent::__get($property);
 }

作者:spiro-stathaki    项目:project   
public function init()
 {
     $this->_error = true;
     $this->_message = [];
     $this->_format = \yii\web\Response::FORMAT_JSON;
     return parent::init();
 }

作者:spiro-stathaki    项目:project   
public function init()
 {
     if (!yii::$app->user->isGuest) {
         $this->_userId = yii::$app->user->id;
     }
     return parent::init();
 }

作者:asasmoy    项目:yii2-sam   
public function init()
 {
     parent::init();
     $configFile = Yii::getAlias($this->configFileName);
     $this->config = (require $configFile);
     $this->instance = new \OneLogin_Saml2_Auth($this->config);
 }

作者:wadeshule    项目:yii2-jwplaye   
public function init()
 {
     parent::init();
     if (!isset($this->key)) {
         throw new InvalidConfigException('JWPlayer: License key missing!');
     }
 }

作者:romka-che    项目:yii2-swipe   
/**
  * @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);
 }

作者:laja    项目:yii2-asset-minifie   
/**
  * @inheritdoc
  * @throws \BadMethodCallException
  */
 public function init()
 {
     parent::init();
     if (exec('command -v java >/dev/null && echo "yes" || echo "no"') == 'no') {
         throw new \BadMethodCallException('Java Not Installed');
     }
 }

作者:luyade    项目:luya-module-cm   
public function init()
 {
     parent::init();
     if ($this->childOf === null || $this->title === null || $this->alias === null) {
         throw new Exception("The properties childOf, title and alias must be defined to inject a new Item.");
     }
 }

作者:jarekkoza    项目:yii2-lib   
public function init()
 {
     parent::init();
     if ($this->properties === TRUE && \Yii::$container->has('jarekkozak\\sys\\IProperties')) {
         $this->setProperties(\Yii::$container->get('jarekkozak\\sys\\IProperties'));
     }
 }

作者:rocksolid-t    项目:luy   
public function __construct(\luya\web\Request $request, \luya\web\UrlManager $urlManager, array $config = [])
 {
     $this->request = $request;
     $this->urlManager = $urlManager;
     // parent object
     parent::__construct($config);
 }


问题


面经


文章

微信
公众号

扫码关注公众号