Passed
Push — master ( 996f7b...019b60 )
by smiley
01:50
created
src/SessionHandlerAbstract.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @param \chillerlan\Traits\ContainerInterface $options
37 37
 	 */
38
-	public function __construct(ContainerInterface $options = null){
38
+	public function __construct(ContainerInterface $options = null) {
39 39
 		$this->options = $options ?? new SessionHandlerOptions;
40 40
 		$this->set_session_options();
41 41
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		setcookie(
53 53
 			session_name(),
54 54
 			session_id(),
55
-			time()+$this->options->cookie_lifetime,
55
+			time() + $this->options->cookie_lifetime,
56 56
 			$this->options->cookie_path,
57 57
 			$cookie_params['domain']
58 58
 		);
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	}
73 73
 
74 74
 	/** @inheritdoc */
75
-	public function get(string $name){
75
+	public function get(string $name) {
76 76
 		return $_SESSION[$name] ?? null;
77 77
 	}
78 78
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	protected function encrypt(string &$data):string {
105 105
 
106
-		if(function_exists('sodium_crypto_secretbox')){
106
+		if (function_exists('sodium_crypto_secretbox')) {
107 107
 			$box = sodium_crypto_secretbox($data, $this::SESSION_NONCE, sodium_hex2bin($this->options->sessionCryptoKey));
108 108
 
109 109
 			sodium_memzero($data);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	protected function decrypt(string $box):string {
124 124
 
125
-		if(function_exists('sodium_crypto_secretbox_open')){
125
+		if (function_exists('sodium_crypto_secretbox_open')) {
126 126
 			return sodium_crypto_secretbox_open(sodium_hex2bin($box), $this::SESSION_NONCE, sodium_hex2bin($this->options->sessionCryptoKey));
127 127
 		}
128 128
 
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
 	/**
133 133
 	 * @return void
134 134
 	 */
135
-	protected function set_session_options(){
135
+	protected function set_session_options() {
136 136
 
137
-		if(is_writable($this->options->save_path)){
137
+		if (is_writable($this->options->save_path)) {
138 138
 			ini_set('session.save_path', $this->options->save_path);
139 139
 		}
140 140
 
@@ -152,14 +152,14 @@  discard block
 block discarded – undo
152 152
 		ini_set('session.cookie_lifetime', '0');
153 153
 #		ini_set('session.referer_check', '');
154 154
 
155
-		if(PHP_VERSION_ID < 70100){
155
+		if (PHP_VERSION_ID < 70100) {
156 156
 			ini_set('session.hash_bits_per_character', '6');
157 157
 
158
-			if(in_array($this->options->hash_algo, hash_algos())){
158
+			if (in_array($this->options->hash_algo, hash_algos())) {
159 159
 				ini_set('session.hash_function', $this->options->hash_algo);
160 160
 			}
161 161
 		}
162
-		else{
162
+		else {
163 163
 			ini_set('session.sid_bits_per_character', '6');
164 164
 			ini_set('session.sid_length', '128');
165 165
 		}
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -158,8 +158,7 @@
 block discarded – undo
158 158
 			if(in_array($this->options->hash_algo, hash_algos())){
159 159
 				ini_set('session.hash_function', $this->options->hash_algo);
160 160
 			}
161
-		}
162
-		else{
161
+		} else{
163 162
 			ini_set('session.sid_bits_per_character', '6');
164 163
 			ini_set('session.sid_length', '128');
165 164
 		}
Please login to merge, or discard this patch.