Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $_SESSION['customer']['items'] = getItems() //returns an array
- $_SESSION['article'][$Id]['name'] = utf8_decode[$received[1]];
- class CustomerPopo
- {
- private $_id;
- private $_salutation;
- private $_name;
- private $_surename;
- public function getId()
- {
- return $this->_id;
- }
- public function setId($value)
- {
- $this->_id = $value;
- }
- public function getSalutation()
- {
- return $this->_salutation;
- }
- public function setSalutation($value)
- {
- $this->_salutation = $value;
- }
- public function getName()
- {
- return $this->_name;
- }
- public function setName($value)
- {
- $this->_name = $value;
- }
- public function getSurename()
- {
- return $this->_surename;
- }
- public function setSurename($value)
- {
- $this->_surename = $value;
- }
- function CustomerPopo() {
- }
- }
- class SessionManager
- {
- private static function getValue($valueName)
- {
- $value = SessionManager::getValueFromSession($valueName);
- if (is_null($value)) {
- //Handle stuff and do further checks
- }
- return $value;
- }
- private static function getValueFromSession($valueName)
- {
- $value = null;
- if (isset($_SESSION[$valueName])) {
- $value = $_SESSION[$valueName];
- }
- return $value;
- }
- private static function setValue($valueName, $value)
- {
- $_SESSION[$valueName] = $value;
- }
- private static function clearValue($valueName)
- {
- if (isset($_SESSION[$valueName])) {
- unset($_SESSION[$valueName]);
- }
- }
- public static function getCustomer()
- {
- $customer = '';
- try {
- $customer = SessionManager::getValue('customer');
- } catch (Exception $e) {
- $customer = '';
- }
- return $customer;
- }
- public static function setCustomer($customer)
- {
- SessionManager::setValue('customer', $customer);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement