Commit 250ec28e by Qiang Xue

Fixes #713.

parent 60ba2049
...@@ -246,15 +246,15 @@ class Component extends Object ...@@ -246,15 +246,15 @@ class Component extends Object
* *
* @param string $name the property name * @param string $name the property name
* @param boolean $checkVar whether to treat member variables as properties * @param boolean $checkVar whether to treat member variables as properties
* @param boolean $checkBehavior whether to treat behaviors' properties as properties of this component * @param boolean $checkBehaviors whether to treat behaviors' properties as properties of this component
* @return boolean whether the property can be read * @return boolean whether the property can be read
* @see canSetProperty * @see canSetProperty
*/ */
public function canGetProperty($name, $checkVar = true, $checkBehavior = true) public function canGetProperty($name, $checkVar = true, $checkBehaviors = true)
{ {
if (method_exists($this, 'get' . $name) || $checkVar && property_exists($this, $name)) { if (method_exists($this, 'get' . $name) || $checkVar && property_exists($this, $name)) {
return true; return true;
} else { } elseif ($checkBehaviors) {
$this->ensureBehaviors(); $this->ensureBehaviors();
foreach ($this->_behaviors as $behavior) { foreach ($this->_behaviors as $behavior) {
if ($behavior->canGetProperty($name, $checkVar)) { if ($behavior->canGetProperty($name, $checkVar)) {
...@@ -276,15 +276,15 @@ class Component extends Object ...@@ -276,15 +276,15 @@ class Component extends Object
* *
* @param string $name the property name * @param string $name the property name
* @param boolean $checkVar whether to treat member variables as properties * @param boolean $checkVar whether to treat member variables as properties
* @param boolean $checkBehavior whether to treat behaviors' properties as properties of this component * @param boolean $checkBehaviors whether to treat behaviors' properties as properties of this component
* @return boolean whether the property can be written * @return boolean whether the property can be written
* @see canGetProperty * @see canGetProperty
*/ */
public function canSetProperty($name, $checkVar = true, $checkBehavior = true) public function canSetProperty($name, $checkVar = true, $checkBehaviors = true)
{ {
if (method_exists($this, 'set' . $name) || $checkVar && property_exists($this, $name)) { if (method_exists($this, 'set' . $name) || $checkVar && property_exists($this, $name)) {
return true; return true;
} else { } elseif ($checkBehaviors) {
$this->ensureBehaviors(); $this->ensureBehaviors();
foreach ($this->_behaviors as $behavior) { foreach ($this->_behaviors as $behavior) {
if ($behavior->canSetProperty($name, $checkVar)) { if ($behavior->canSetProperty($name, $checkVar)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment