本文整理汇总了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);
}
}
示例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);
}
}
示例3: __get
public function __get($name)
{
if (isset($this->_user[$name])) {
return $this->_user[$name];
}
return parent::__get($name);
}
示例4: init
public function init()
{
parent::init();
if (!empty($this->fileHash)) {
$this->fileInfo = FileInfo::findOne(['hash' => $this->fileHash]);
}
}
示例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.');
}
}
示例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}'"];
}
}
示例7: init
/**
* @inheritdoc
* @throws \yii\base\InvalidConfigException
*/
public function init()
{
if ($this->name === null) {
throw new InvalidConfigException("'name' cannot be null.");
}
parent::init();
}
示例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");
}
}
示例9: init
/**
* {@inheritdoc}
*/
public function init()
{
parent::init();
if (is_null($this->remote)) {
throw new InvalidConfigException('$remote must be set.');
}
}
示例10: __get
public function __get($property)
{
if ($this->isNestedProperty($property)) {
return $this->getNestedProperty($property);
}
return parent::__get($property);
}
示例11: init
public function init()
{
$this->_error = true;
$this->_message = [];
$this->_format = \yii\web\Response::FORMAT_JSON;
return parent::init();
}
示例12: init
public function init()
{
if (!yii::$app->user->isGuest) {
$this->_userId = yii::$app->user->id;
}
return parent::init();
}
示例13: init
public function init()
{
parent::init();
$configFile = Yii::getAlias($this->configFileName);
$this->config = (require $configFile);
$this->instance = new \OneLogin_Saml2_Auth($this->config);
}
示例14: init
public function init()
{
parent::init();
if (!isset($this->key)) {
throw new InvalidConfigException('JWPlayer: License key missing!');
}
}
示例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);
}