Passed
Push — master ( a82ddd...e18794 )
by smiley
01:22
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
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	protected function encrypt(string &$data):string {
123 123
 
124
-		if(\function_exists('sodium_crypto_secretbox')){
124
+		if (\function_exists('sodium_crypto_secretbox')) {
125 125
 			$box = \sodium_crypto_secretbox($data, $this::SESSION_NONCE, \sodium_hex2bin($this->options->sessionCryptoKey));
126 126
 
127 127
 			\sodium_memzero($data);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 */
141 141
 	protected function decrypt(string $box):string {
142 142
 
143
-		if(\function_exists('sodium_crypto_secretbox_open')){
143
+		if (\function_exists('sodium_crypto_secretbox_open')) {
144 144
 			return \sodium_crypto_secretbox_open(\sodium_hex2bin($box), $this::SESSION_NONCE, \sodium_hex2bin($this->options->sessionCryptoKey));
145 145
 		}
146 146
 
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
 	public function setOptions(SettingsContainerInterface $options):SessionInterface{
156 156
 
157 157
 		// end an active session before setting new options
158
-		if($this->active()){
158
+		if ($this->active()) {
159 159
 			$this->end();
160 160
 		}
161 161
 
162
-		if(\is_writable($options->save_path)){
162
+		if (\is_writable($options->save_path)) {
163 163
 			\ini_set('session.save_path', $options->save_path);
164 164
 		}
165 165
 
Please login to merge, or discard this patch.