Skip to content

Commit 93abfb1

Browse files
kenjisMGatner
authored andcommitted
style: break long lines
1 parent bd3343a commit 93abfb1

2 files changed

Lines changed: 28 additions & 7 deletions

File tree

system/Session/Handlers/DatabaseHandler.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,11 @@ public function gc($max_lifetime)
276276
$separator = ' ';
277277
$interval = implode($separator, ['', "{$max_lifetime} second", '']);
278278

279-
return $this->db->table($this->table)->where('timestamp <', "now() - INTERVAL {$interval}", false)->delete() ? 1 : $this->fail();
279+
return $this->db->table($this->table)->where(
280+
'timestamp <',
281+
"now() - INTERVAL {$interval}",
282+
false
283+
)->delete() ? 1 : $this->fail();
280284
}
281285

282286
/**

system/Session/Handlers/MemcachedHandler.php

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,14 @@ public function open($path, $name): bool
8989
$serverList[] = $server['host'] . ':' . $server['port'];
9090
}
9191

92-
if (! preg_match_all('#,?([^,:]+)\:(\d{1,5})(?:\:(\d+))?#', $this->savePath, $matches, PREG_SET_ORDER)) {
92+
if (
93+
! preg_match_all(
94+
'#,?([^,:]+)\:(\d{1,5})(?:\:(\d+))?#',
95+
$this->savePath,
96+
$matches,
97+
PREG_SET_ORDER
98+
)
99+
) {
93100
$this->memcached = null;
94101
$this->logger->error('Session: Invalid Memcached save path format: ' . $this->savePath);
95102

@@ -99,13 +106,17 @@ public function open($path, $name): bool
99106
foreach ($matches as $match) {
100107
// If Memcached already has this server (or if the port is invalid), skip it
101108
if (in_array($match[1] . ':' . $match[2], $serverList, true)) {
102-
$this->logger->debug('Session: Memcached server pool already has ' . $match[1] . ':' . $match[2]);
109+
$this->logger->debug(
110+
'Session: Memcached server pool already has ' . $match[1] . ':' . $match[2]
111+
);
103112

104113
continue;
105114
}
106115

107116
if (! $this->memcached->addServer($match[1], (int) $match[2], $match[3] ?? 0)) {
108-
$this->logger->error('Could not add ' . $match[1] . ':' . $match[2] . ' to Memcached server pool.');
117+
$this->logger->error(
118+
'Could not add ' . $match[1] . ':' . $match[2] . ' to Memcached server pool.'
119+
);
109120
} else {
110121
$serverList[] = $match[1] . ':' . $match[2];
111122
}
@@ -260,7 +271,9 @@ protected function lockSession(string $sessionID): bool
260271
}
261272

262273
if (! $this->memcached->set($lockKey, Time::now()->getTimestamp(), 300)) {
263-
$this->logger->error('Session: Error while trying to obtain lock for ' . $this->keyPrefix . $sessionID);
274+
$this->logger->error(
275+
'Session: Error while trying to obtain lock for ' . $this->keyPrefix . $sessionID
276+
);
264277

265278
return false;
266279
}
@@ -270,7 +283,9 @@ protected function lockSession(string $sessionID): bool
270283
} while (++$attempt < 30);
271284

272285
if ($attempt === 30) {
273-
$this->logger->error('Session: Unable to obtain lock for ' . $this->keyPrefix . $sessionID . ' after 30 attempts, aborting.');
286+
$this->logger->error(
287+
'Session: Unable to obtain lock for ' . $this->keyPrefix . $sessionID . ' after 30 attempts, aborting.'
288+
);
274289

275290
return false;
276291
}
@@ -290,7 +305,9 @@ protected function releaseLock(): bool
290305
! $this->memcached->delete($this->lockKey)
291306
&& $this->memcached->getResultCode() !== Memcached::RES_NOTFOUND
292307
) {
293-
$this->logger->error('Session: Error while trying to free lock for ' . $this->lockKey);
308+
$this->logger->error(
309+
'Session: Error while trying to free lock for ' . $this->lockKey
310+
);
294311

295312
return false;
296313
}

0 commit comments

Comments
 (0)