88
99class SessionConfig
1010{
11- protected $ serverName ;
11+ protected string $ serverName ;
1212
13- protected $ sessionContext = 'default ' ;
14- protected $ timeoutMinutes = 20 ;
15- protected $ cookieDomain = null ;
16- protected $ cookiePath = '/ ' ;
17- protected $ jwtKey = null ;
18- protected $ replaceSessionHandler = null ;
13+ protected string $ sessionContext = 'default ' ;
14+ protected int $ timeoutMinutes = 20 ;
15+ protected ? string $ cookieDomain = null ;
16+ protected string $ cookiePath = '/ ' ;
17+ protected ? JwtKeyInterface $ jwtKey = null ;
18+ protected ? bool $ replaceSessionHandler = null ;
1919
2020 /**
2121 * SessionConfig constructor.
@@ -26,95 +26,104 @@ public function __construct($serverName)
2626 $ this ->serverName = $ serverName ;
2727 }
2828
29- public function withSessionContext ($ context ) {
29+ public function withSessionContext ($ context ): static
30+ {
3031 $ this ->sessionContext = $ context ;
3132 return $ this ;
3233 }
3334
34- public function withTimeoutMinutes ($ timeout ) {
35+ public function withTimeoutMinutes ($ timeout ): static
36+ {
3537 $ this ->timeoutMinutes = $ timeout ;
3638 return $ this ;
3739 }
3840
39- public function withTimeoutHours ($ timeout ) {
41+ public function withTimeoutHours ($ timeout ): static
42+ {
4043 $ this ->timeoutMinutes = $ timeout * 60 ;
4144 return $ this ;
4245 }
4346
44- public function withCookie ($ domain , $ path = "/ " ) {
47+ public function withCookie ($ domain , $ path = "/ " ): static
48+ {
4549 $ this ->cookieDomain = $ domain ;
4650 $ this ->cookiePath = $ path ;
4751 return $ this ;
4852 }
4953
50- public function withSecret ($ secret ) {
54+ public function withSecret ($ secret ): static
55+ {
5156 $ this ->jwtKey = new JwtKeySecret ($ secret );
5257 return $ this ;
5358 }
5459
55- public function withRsaSecret ($ private , $ public ) {
60+ public function withRsaSecret ($ private , $ public ): static
61+ {
5662 $ this ->jwtKey = new JwtRsaKey ($ private , $ public );
5763 return $ this ;
5864 }
5965
60- public function replaceSessionHandler ($ startSession = true ) {
66+ public function replaceSessionHandler ($ startSession = true ): static
67+ {
6168 $ this ->replaceSessionHandler = $ startSession ;
6269 return $ this ;
6370 }
6471
6572 /**
66- * @return mixed
73+ * @return string
6774 */
68- public function getServerName ()
75+ public function getServerName (): string
6976 {
7077 return $ this ->serverName ;
7178 }
7279
7380 /**
7481 * @return string
7582 */
76- public function getSessionContext ()
83+ public function getSessionContext (): string
7784 {
7885 return $ this ->sessionContext ;
7986 }
8087
8188 /**
8289 * @return int
8390 */
84- public function getTimeoutMinutes ()
91+ public function getTimeoutMinutes (): int
8592 {
8693 return $ this ->timeoutMinutes ;
8794 }
8895
8996 /**
90- * @return null
97+ * @return string| null
9198 */
92- public function getCookieDomain ()
99+ public function getCookieDomain (): ? string
93100 {
94101 return $ this ->cookieDomain ;
95102 }
96103
97104 /**
98105 * @return string
99106 */
100- public function getCookiePath ()
107+ public function getCookiePath (): string
101108 {
102109 return $ this ->cookiePath ;
103110 }
104111
105112 /**
106- * @return JwtKeyInterface
113+ * @return JwtKeyInterface|null
107114 */
108- public function getKey ()
115+ public function getKey (): ? JwtKeyInterface
109116 {
110117 return $ this ->jwtKey ;
111118 }
112119
113- public function isReplaceSession () {
120+ public function isReplaceSession (): bool
121+ {
114122 return $ this ->replaceSessionHandler !== null ;
115123 }
116124
117- public function isStartSession () {
125+ public function isStartSession (): bool
126+ {
118127 return $ this ->replaceSessionHandler === true ;
119128 }
120129}
0 commit comments