MetaAction::__get PHP Method

__get() public method

Returns the value of the given property; throws InvalidPropertyHandlerException if the property didn't exist.
public __get ( string $p_property ) : mixed
$p_property string
return mixed
    public function __get($p_property)
    {
        $p_property = MetaAction::TranslateProperty($p_property);
        if ($p_property == 'defined') {
            return $this->defined();
        }
        if ($p_property == 'is_error') {
            return PEAR::isError($this->m_error);
        }
        if ($p_property == 'error_code') {
            return PEAR::isError($this->m_error) ? $this->m_error->getCode() : null;
        }
        if ($p_property == 'error_message') {
            return PEAR::isError($this->m_error) ? $this->m_error->getMessage() : null;
        }
        if ($p_property == 'ok') {
            return $this->getError() === ACTION_OK;
        }
        if ($p_property == 'name') {
            return $this->m_name;
        }
        if (!is_array($this->m_properties) || !array_key_exists($p_property, $this->m_properties)) {
            $this->trigger_invalid_property_error($p_property);
        }
        if (is_string($this->m_properties[$p_property]) && method_exists($this, $this->m_properties[$p_property])) {
            $methodName = $this->m_properties[$p_property];
            return $this->{$methodName}();
        }
        return $this->m_properties[$p_property];
    }

Usage Example

 /**
  * Returns the value of the given property; throws
  * InvalidPropertyHandlerException if the property didn't exist.
  *
  * @param string $p_property
  * @return mixed
  */
 public function __get($p_property)
 {
     $p_property = MetaAction::TranslateProperty($p_property);
     if ($p_property == 'results_count') {
         if (!empty($this->m_totalCount)) {
             return $this->m_totalCount;
         }
         if ($this->m_properties['scope'] == 'index') {
             Article::SearchByKeyword($this->m_properties['search_keywords'], $this->m_properties['match_all'], $this->m_properties['constraints'], array(), 0, 0, $this->m_totalCount, true);
         } else {
             Article::SearchByField($this->m_properties['search_keywords'], $this->m_properties['scope'], $this->m_properties['match_all'], $this->m_properties['constraints'], array(), 0, 0, $this->m_totalCount, true);
         }
         return $this->m_totalCount;
     }
     return parent::__get($p_property);
 }