public function __get($key) { if ($this->isEloquent()) { return $this->data->__get($key); } return object_get($this->data, $key); }
/** * Getter. * * @param string $key The name of the variable. * * @return mixed The value of the variable. * @throws Exception */ public function &__get($key) { if (array_key_exists($key, $this->_data)) { return $this->_data[$key]; } if ($this->_parent !== null) { return $this->_parent->__get($key); } throw new Exception("Undefined variable `{$key}`."); }
/** * @param string $name * @return mixed|null */ private function readPropertySecure($name) { if (property_exists($this->dataPiece, $name)) { return $this->dataPiece->{$name}; } try { if (method_exists($this->dataPiece, '__get')) { return $this->dataPiece->__get($name); } } catch (\Exception $e) { return null; } return null; }
/** * {@inheritDoc} */ public function hasAuthorizationState($service) { if (!empty($this->user->__get($this->stateKey))) { return true; } return false; }
/** * Return an object property * @param string * @return mixed */ public function __get($strKey) { switch ($strKey) { case 'language': return $this->strLanguage; break; default: return $this->{$strKey} ? $this->{$strKey} : $this->objEmail->__get($strKey); break; } }
public function __get($asserter) { switch (strtolower($asserter)) { case 'size': return $this->size(); case 'isempty': return $this->isEmpty(); case 'isnotempty': return $this->isNotEmpty(); default: return parent::__get($asserter); } }
/** * Retrieve the fields. * @access public * @since 6.0.0 * @param string $section The section to search for fields in (optional). * @return array An array of the detected fields. */ public function get_fields($section = '') { $fields = array(); foreach ($this->_field_obj->__get('fields') as $k => $v) { if ('' != $section) { if ($section == $v['section']) { $fields[$k] = $v; } } else { $fields[$k] = $v; } } return $fields; }
/** * Getter. * * @param string $key The name of the variable. * @return mixed The value of the variable. */ public function &__get($key) { if (array_key_exists($key, $this->_data)) { return $this->_data[$key]; } if ($this->_parent !== null) { return $this->_parent->__get($key); } if (in_array($key, static::$_reserved)) { if ($key == 'expect') { throw new Exception("You can't use expect() inside of describe()"); } } throw new Exception("Undefined variable `{$key}`."); }
/** * Recupera e atribui os valores para o controlador, action e param * Verifica se existe o arquivo do controlador solicidado * Verifica se existe o metódo da action solicidada * Executa o controlador, caso exista * Executa a ação e informa os parâmetros, caso a ação exista */ public function start() { $controller = $this->uri->__get('controller'); $action = $this->uri->__get('action'); $param = $this->uri->__get('param'); if (is_null($controller)) { $controller = DEFAULT_INDEX; } else { if (!file_exists(CONTROLLERS_PATH . ucfirst($controller) . 'Controller.php')) { Response::redirectIn(NOTFOUND_PAGE); } } $instance_controller = '\\application\\controllers\\' . ucfirst($controller) . 'Controller'; $class = new $instance_controller(); if (is_null($action)) { $action = 'index'; } else { if (!method_exists($class, $action . 'Action')) { Response::redirectIn(NOTFOUND_PAGE); } } $action = $action . 'Action'; $class->{$action}($param); }
/** * Getter. * * @param string $key The name of the variable. * @return mixed The value of the variable. */ public function &__get($key) { if (array_key_exists($key, $this->_data)) { return $this->_data[$key]; } if (array_key_exists($key, $this->_given)) { $scope = static::current(); $scope->{$key} = $this->_given[$key]($scope); return $scope->__get($key); } if ($this->_parent !== null) { return $this->_parent->__get($key); } if (in_array($key, static::$blacklist)) { if ($key == 'expect') { throw new Exception("You can't use expect() inside of describe()"); } } throw new Exception("Undefined variable `{$key}`."); }
/** * Returns a variable from the wrapped object. This should be used instead of * $this->ep_object->$var_name for the support of private/protected vars. * * Please note that no long do we call $this->ep_object->$var_name directly. * Instead we use this method to alter an var in the object. * * @return mixed Variable from the wrapped object, accessed directly, or via __get, or via get<Var_name>. * @access protected */ protected function &epObjectGetVar($var_name) { // public variable $public_vars = array_keys(get_object_vars($this->ep_object)); if (in_array($var_name, $public_vars)) { return $this->ep_object->{$var_name}; } // specific getter getVar_name() $getter = 'get' . ucfirst($var_name); if (in_array($getter, $this->ep_cached_methods)) { $res =& $this->ep_object->{$getter}(); return $res; } // generic getter __get() if (in_array('__get', $this->ep_cached_methods)) { $res =& $this->ep_object->__get($var_name); return $res; } // otherwise error throw new epExceptionObject('Variable [' . $this->_varName($var_name) . '] is not public nor does it have public getter'); return self::$false; }
/** * Get things moving. * * Defines some class variables and starts the processinging. * * @since Astoundify Crowdfunding 1.8 * * @return void */ function __construct($campaign_id, $process_failed = false) { global $edd_options; $this->to_process = isset($edd_options['atcf_to_process']) ? $edd_options['atcf_to_process'] : 20; $this->process_failed = $process_failed; $this->campaign_id = $campaign_id; $this->campaign = atcf_get_campaign($this->campaign_id); $this->payments = $this->campaign->__get('_payment_ids'); $this->failed_payments = $this->campaign->__get('_campaign_failed_payments'); if ($this->process_failed) { $this->payments = $this->failed_payments; } $this->gateways = edd_get_enabled_payment_gateways(); $this->get_payments(); $this->sort_payments(); $this->process(); $this->log_failed(); $this->cleanup(); }
/** * * @param object $var * @return array */ private function object_to_array($var) { $result = array(); foreach ($var->getVarList() as $key) { $value = $var->__get($key); if (is_object($value) || is_array($value)) { $result[$key] = self::object_to_array($value); } else { $result[$key] = $value; } } return $result; }