1: <?php
2:
3: namespace Genetsis\core;
4:
5: /**
6: * This class stores data from user's session generated by Genetsis ID.
7: *
8: * @package Genetsis
9: * @category Bean
10: * @version 1.0
11: * @access private
12: */
13: class Things
14: {
15: /** @var {@link ClientToken} Object who stores the "client_token" data. */
16: private $client_token = null;
17: /** @var {@link AccessToken} Object who stores the "access_token" data. */
18: private $access_token = null;
19: /** @var {@link LoginStatus} Object who stores the user's login status. */
20: private $login_status = null;
21: /** @var {@link RefreshToken} Object who stores the user's refresh token. */
22: private $refresh_token = null;
23:
24: public function __construct()
25: {
26: if (isset($_SESSION['Things'])) {
27: $myThings = unserialize($_SESSION['Things']);
28:
29: $this->setClientToken($myThings->getClientToken());
30: $this->setAccessToken($myThings->getAccessToken());
31: $this->setRefreshToken($myThings->getRefreshToken());
32: $this->setLoginStatus($myThings->getLoginStatus());
33:
34: }
35: }
36:
37: /**
38: * Returns the stored "client_token".
39: *
40: * @return ClientToken An instance of {@link ClientToken} or NULL if not set.
41: */
42: public function getClientToken()
43: {
44: return $this->client_token;
45: }
46:
47: /**
48: * Sets the "client_token".
49: *
50: * @param ClientToken An instance of {@link ClientToken} or NULL to remove it.
51: */
52: public function setClientToken($clientToken)
53: {
54: $this->client_token = $clientToken;
55: }
56:
57: /**
58: * Returns the "access_token".
59: *
60: * @return AccessToken An instance of {@link AccessToken} or NULL if not set.
61: */
62: public function getAccessToken()
63: {
64: return $this->access_token;
65: }
66:
67: /**
68: * Sets the "access_token".
69: *
70: * @param AccessToken An instance of {@link AccessToken} or NULL to remove it.
71: */
72: public function setAccessToken($userToken)
73: {
74: $this->access_token = $userToken;
75: }
76:
77: /**
78: * Returns the login status object.
79: *
80: * @return mixed|LoginStatus An instance of {@link LoginStatus} or NULL if not set.
81: */
82: public function getLoginStatus()
83: {
84: return $this->login_status;
85: }
86:
87: /**
88: * Sets the user's login status.
89: *
90: * @param mixed A instance of {@link LoginStatus} or NULL to remove it.
91: */
92: public function setLoginStatus($loginStatus)
93: {
94: $this->login_status = $loginStatus;
95: }
96:
97: /**
98: * Returns the "refresh_token".
99: *
100: * @return mixed An instance of {@link RefreshToken} or NULL if not set.
101: */
102: public function getRefreshToken()
103: {
104: return $this->refresh_token;
105: }
106:
107: /**
108: * Sets the "refresh_token".
109: *
110: * @param mixed An instance of {@link RefreshToken} or NULL to remove it.
111: */
112: public function setRefreshToken($refreshToken)
113: {
114: $this->refresh_token = $refreshToken;
115: }
116: }