本文整理汇总了PHP中Nette\Object::__set方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::__set方法的具体用法?PHP Object::__set怎么用?PHP Object::__set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Object
的用法示例。
在下文中一共展示了Object::__set方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __set
public function __set($name, $value)
{
$val = \strtoupper($name);
if (\defined(self::OPT . $val)) {
return $this->setOption(constant(self::OPT . $val), $value);
}
if ('HEADER_OUT' === $val) {
return $this->setOption(CURLINFO_HEADER_OUT, $value);
}
return parent::__set($name, $value);
}
示例2: __set
/**
* Sets user data value.
* @param string property name
* @param mixed property value
* @return void
*/
public function __set($key, $value)
{
if (parent::__isset($key)) {
parent::__set($key, $value);
} else {
$this->data[$key] = $value;
}
}
示例3: __set
public function __set($name, $value)
{
if (parent::__isset($name)) {
parent::__set($name, $value);
} else {
$this->data->{$name} = $value;
}
}
示例4: __set
/**
* Magic setter to $this->data
* @param string $name
* @param mixed $value
*/
public function __set($name, $value)
{
try {
parent::__set($name, $value);
} catch (MemberAccessException $e) {
$this->data[$name] = $value;
}
}
示例5: __set
/**
* Setter proměnných.
* @param mixed $name
* @param mixed $value
*/
public function __set($name, $value)
{
parent::__set($name, $value);
}
示例6: __set
/**
* Setter
*
* @param string $name
* @param mixed $value
* @return mixed
* @throws MemberAccessException
*/
public function __set($name, $value)
{
try {
return $this->universalSetValue($name, $value);
} catch (\MemberAccessException $e) {
return parent::__set($name, $value);
}
}
示例7: __set
/**
* Sets value of a property. Do not call directly.
* Tries to use dynamic setter for protected properties (reflection fields) if setter is not defined.
*
* @param string property name
* @param mixed property value
* @return void
* @throws MemberAccessException if the property is not defined or is read-only
*/
public function __set($name, $value)
{
try {
parent::__set($name, $value);
} catch (MemberAccessException $e) {
if ($this->hasProtectedReflectionField($name)) {
// intentionally not used __isset
$this->{$name} = $value;
} else {
throw new MemberAccessException($e->getMessage() . " If you want to use dynamic setter for this property, make sure that property has visibility 'protected'.");
}
}
}
示例8: __set
/**
* @param string $name
* @param mixed $value
*/
public function __set($name, $value)
{
if ($this->isOption($name) && !property_exists($this, $name)) {
$this->setOption($name, $value);
} else {
parent::__set($name, $value);
}
}
示例9: __set
public function __set($name, $value)
{
foreach ($this->getExtensions() as $extension) {
/* @var $extension ExtensionObject */
if ($extension->getReflection()->hasProperty($name)) {
$property = $extension->getReflection()->getProperty($name);
if ($property->isPublic() && !$property->isStatic()) {
$extension->{$name} = $value;
return;
}
}
if (ObjectMixin::has($extension, $name)) {
ObjectMixin::set($extension, $name, $value);
return;
}
}
return parent::__set($name, $value);
}