本文整理汇总了PHP中Nette\ObjectMixin类的典型用法代码示例。如果您正苦于以下问题:PHP ObjectMixin类的具体用法?PHP ObjectMixin怎么用?PHP ObjectMixin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ObjectMixin类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __call
/**
* Call to undefined method.
* @param string method name
* @param array arguments
* @return mixed
* @throws MemberAccessException
*/
public function __call($name, $args)
{
$class = new Nette\Reflection\ClassType($this);
if ($name === '') {
throw new Nette\MemberAccessException("Call to class '{$class->name}' method without name.");
}
// event functionality
if ($class->hasProperty($name)) {
if (!$this->_eventSetupCalled) {
$this->_eventSetupCalled = true;
$this->eventSetup();
$this->onEventSetup($this);
}
if (is_array($list = $this->{$name}) || $list instanceof \Traversable) {
foreach ($list as $handler) {
callback($handler)->invokeArgs($args);
}
}
return NULL;
}
// extension methods
if ($cb = Nette\ObjectMixin::getExtensionMethod(get_class($this), $name)) {
array_unshift($args, $this);
return $cb->invokeArgs($args);
}
throw new Nette\MemberAccessException("Call to undefined method {$class->name}::{$name}().");
}
示例2: __unset
public function __unset($key)
{
$column = $this->formatColumnName($key);
if (parent::__isset($column) || !ObjectMixin::has($this, $key)) {
parent::__unset($column);
} else {
ObjectMixin::remove($this, $key);
}
}
示例3: getItemValue
/**
* @param $item
* @param $valueName
* @return mixed
*/
public function getItemValue($item, $valueName)
{
if (isset($this->columnAliases[$valueName])) {
$getterPath = $this->columnAliases[$valueName]->getterPath;
} else {
$getterPath = $valueName;
}
$getters = explode('.', $getterPath);
$value = $item;
foreach ($getters as $getter) {
$value = ObjectMixin::get($value, $getter);
}
return $value;
}
示例4: __call
public function __call($name, $args)
{
return Nette\ObjectMixin::callProperty($this, $name, $args);
}
示例5: __unset
/**
* Access to undeclared property.
* @param string property name
* @return void
* @throws Nette\MemberAccessException
*/
public function __unset($name)
{
Nette\ObjectMixin::remove($this, $name);
}
示例6: __isset
public function __isset($name)
{
return ObjectMixin::has($this, $name);
}
示例7: __call
/**
* @param $method
* @param $args
*/
public function __call($method, $args)
{
ObjectMixin::call($this, $method, $args);
}
示例8: __call
Nette\Object{public$name;public$value;public$static;public$visibility='public';public$documents=array();function
__call($name,$args){return
Nette\ObjectMixin::callProperty($this,$name,$args);}}}namespace Nette\Utils{use
示例9: __isset
/**
* Is property defined?
*
* @param string property name
* @return bool
*/
public function __isset($name)
{
return ObjectMixin::has($this, $name) ? TRUE : (isset($this->_data[$name]) ? TRUE : array_key_exists($name, $this->_associations));
}
示例10: __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);
}