Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.0.0dev1

Request #2886 Easily retrieve Option defined
Submitted: 2004-12-03 23:45 UTC
From: farell Assigned:
Status: Open Package: Auth_PrefManager2
PHP Version: 4.3.9 OS: Windows XP
Roadmaps: (Not assigned)    
Subscription  


 [2004-12-03 23:45 UTC] farell
Description: ------------ It could be interresting to retrieve all options given to the constructor class, or just one of them, at any time. I suggest to add a function like that into the Container.php file: function getOption($option = null) { if (is_null($option)) { return $this->_options; } elseif (isset($this->_options[$option])) { return $this->_options[$option]; } else { return false; // perharps throw an error } } Reproduce code: --------------- For example: <?php require_once 'Auth/PrefManager2.php'; $options = array('debug' => true, 'default_app' => 'Auth2'); $prefs = &Auth_PrefManager2::factory('Array', $options); $App = $prefs->getOption('default_app'); $prefs->setPref("fullname", "Jon Wood"); $jonName = $prefs->getPref("fullname"); echo "<p>Jon's name is $jonName for application '$App'</p>"; ?>

Comments