Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. $_SESSION['customer']['items'] = getItems() //returns an array
  2. $_SESSION['article'][$Id]['name'] = utf8_decode[$received[1]];
  3.  
  4. class CustomerPopo
  5. {
  6.  
  7. private $_id;
  8.  
  9. private $_salutation;
  10.  
  11. private $_name;
  12.  
  13. private $_surename;
  14.  
  15. public function getId()
  16. {
  17. return $this->_id;
  18. }
  19.  
  20. public function setId($value)
  21. {
  22. $this->_id = $value;
  23. }
  24.  
  25. public function getSalutation()
  26. {
  27. return $this->_salutation;
  28. }
  29.  
  30. public function setSalutation($value)
  31. {
  32. $this->_salutation = $value;
  33. }
  34.  
  35. public function getName()
  36. {
  37. return $this->_name;
  38. }
  39.  
  40. public function setName($value)
  41. {
  42. $this->_name = $value;
  43. }
  44.  
  45. public function getSurename()
  46. {
  47. return $this->_surename;
  48. }
  49.  
  50. public function setSurename($value)
  51. {
  52. $this->_surename = $value;
  53. }
  54.  
  55. function CustomerPopo() {
  56.  
  57. }
  58. }
  59.  
  60. class SessionManager
  61. {
  62.  
  63. private static function getValue($valueName)
  64. {
  65. $value = SessionManager::getValueFromSession($valueName);
  66. if (is_null($value)) {
  67. //Handle stuff and do further checks
  68. }
  69. return $value;
  70. }
  71.  
  72. private static function getValueFromSession($valueName)
  73. {
  74. $value = null;
  75. if (isset($_SESSION[$valueName])) {
  76. $value = $_SESSION[$valueName];
  77. }
  78. return $value;
  79. }
  80.  
  81. private static function setValue($valueName, $value)
  82. {
  83. $_SESSION[$valueName] = $value;
  84. }
  85.  
  86. private static function clearValue($valueName)
  87. {
  88. if (isset($_SESSION[$valueName])) {
  89. unset($_SESSION[$valueName]);
  90. }
  91. }
  92.  
  93. public static function getCustomer()
  94. {
  95. $customer = '';
  96. try {
  97. $customer = SessionManager::getValue('customer');
  98. } catch (Exception $e) {
  99. $customer = '';
  100. }
  101. return $customer;
  102. }
  103.  
  104. public static function setCustomer($customer)
  105. {
  106. SessionManager::setValue('customer', $customer);
  107. }
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement