From: <gem...@li...> - 2011-11-29 08:34:16
|
Revision: 308 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=308&view=rev Author: mennodekker Date: 2011-11-29 08:34:05 +0000 (Tue, 29 Nov 2011) Log Message: ----------- Created a get method for organizationData so simple additions to organizationData don't need to subclass to access their variables Modified Paths: -------------- branches/userloader/classes/Gems/User/Organization.php Modified: branches/userloader/classes/Gems/User/Organization.php =================================================================== --- branches/userloader/classes/Gems/User/Organization.php 2011-11-29 08:14:48 UTC (rev 307) +++ branches/userloader/classes/Gems/User/Organization.php 2011-11-29 08:34:05 UTC (rev 308) @@ -98,7 +98,6 @@ /** * Returns a callable if a method is called as a variable - * or the value from the organizationData if it exists * * @param string $name * @return Callable @@ -108,9 +107,7 @@ if (method_exists($this, $name)) { // Return a callable return array($this, $name); - } elseif (isset($this->_organizationData[$name])) { - return $this->_organizationData[$name]; - } + } throw new Gems_Exception_Coding("Unknown method '$name' requested as callable."); } @@ -155,6 +152,22 @@ } /** + * Returns the $key in organizationData when set otherwise the default value + * + * @param string $key + * @param mixed $default + * @return mixed + */ + public function get($key, $default = null) + { + if (array_key_exists($key, $this->_organizationData)) { + return $this->_organizationData[$key]; + } else { + return $default; + } + } + + /** * Get the style attribute. * * @return string This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |