Passed
Push — master ( 0b8861...3fc8df )
by smiley
01:25
created
src/SessionHandlerAbstract.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @param \chillerlan\Settings\SettingsContainerInterface $options
36 36
 	 * @param \Psr\Log\LoggerInterface|null                  $logger
37 37
 	 */
38
-	public function __construct(SettingsContainerInterface $options = null, LoggerInterface $logger = null){
38
+	public function __construct(SettingsContainerInterface $options = null, LoggerInterface $logger = null) {
39 39
 		$this->options = $options ?? new SessionHandlerOptions;
40 40
 		$this->logger  = $logger ?? new NullLogger;
41 41
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 */
51 51
 	public function start():SessionInterface{
52 52
 
53
-		if($this->active()){
53
+		if ($this->active()) {
54 54
 			throw new SessionHandlerException('session already running');
55 55
 		}
56 56
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	/** @inheritdoc */
74 74
 	public function end():SessionInterface{
75 75
 
76
-		if($this->active()){
76
+		if ($this->active()) {
77 77
 			\session_regenerate_id(true);
78 78
 			\setcookie(\session_name(), '', 0, $this->options->cookie_path);
79 79
 			\session_unset();
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	}
91 91
 
92 92
 	/** @inheritdoc */
93
-	public function get(string $name){
93
+	public function get(string $name) {
94 94
 		return $_SESSION[$name] ?? null;
95 95
 	}
96 96
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	protected function encrypt(string &$data):string {
128 128
 
129
-		if(\function_exists('sodium_crypto_secretbox')){
129
+		if (\function_exists('sodium_crypto_secretbox')) {
130 130
 			$box = \sodium_crypto_secretbox($data, $this::SESSION_NONCE, \sodium_hex2bin($this->options->sessionCryptoKey));
131 131
 
132 132
 			\sodium_memzero($data);
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 */
146 146
 	protected function decrypt(string $box):string {
147 147
 
148
-		if(\function_exists('sodium_crypto_secretbox_open')){
148
+		if (\function_exists('sodium_crypto_secretbox_open')) {
149 149
 			return \sodium_crypto_secretbox_open(\sodium_hex2bin($box), $this::SESSION_NONCE, \sodium_hex2bin($this->options->sessionCryptoKey));
150 150
 		}
151 151
 
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
 	public function setOptions(SettingsContainerInterface $options):SessionInterface{
161 161
 
162 162
 		// end an active session before setting new options
163
-		if($this->active()){
163
+		if ($this->active()) {
164 164
 			$this->end();
165 165
 		}
166 166
 
167
-		if(\is_writable($options->save_path)){
167
+		if (\is_writable($options->save_path)) {
168 168
 			\ini_set('session.save_path', $options->save_path);
169 169
 		}
170 170
 
Please login to merge, or discard this patch.