本文整理匯總了PHP中Style::__get方法的典型用法代碼示例。如果您正苦於以下問題:PHP Style::__get方法的具體用法?PHP Style::__get怎麽用?PHP Style::__get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Style
的用法示例。
在下文中一共展示了Style::__get方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: inherit
/**
* Set inherited properties in this style using values in $parent
*
* @param Style $parent
*
* @return Style
*/
function inherit(Style $parent)
{
// Set parent font size
$this->_parent_font_size = $parent->get_font_size();
foreach (self::$_inherited as $prop) {
//inherit the !important property also.
//if local property is also !important, don't inherit.
if (isset($parent->_props[$prop]) && (!isset($this->_props[$prop]) || isset($parent->_important_props[$prop]) && !isset($this->_important_props[$prop]))) {
if (isset($parent->_important_props[$prop])) {
$this->_important_props[$prop] = true;
}
//see __set and __get, on all assignments clear cache!
$this->_prop_cache[$prop] = null;
$this->_props[$prop] = $parent->_props[$prop];
}
}
foreach ($this->_props as $prop => $value) {
if ($value === "inherit") {
if (isset($parent->_important_props[$prop])) {
$this->_important_props[$prop] = true;
}
//do not assign direct, but
//implicite assignment through __set, redirect to specialized, get value with __get
//This is for computing defaults if the parent setting is also missing.
//Therefore do not directly assign the value without __set
//set _important_props before that to be able to propagate.
//see __set and __get, on all assignments clear cache!
//$this->_prop_cache[$prop] = null;
//$this->_props[$prop] = $parent->_props[$prop];
//props_set for more obvious explicite assignment not implemented, because
//too many implicite uses.
// $this->props_set($prop, $parent->$prop);
$this->__set($prop, $parent->__get($prop));
}
}
return $this;
}