Skip to content

Commit 3769d30

Browse files
committed
CS Fixes
1 parent c1c136c commit 3769d30

File tree

7 files changed

+18
-16
lines changed

7 files changed

+18
-16
lines changed

example/Logger/CacheDataLogger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function __construct($logFilePath)
1919
if (count($pathParts) > 1) {
2020
unset($pathParts[count($pathParts) - 1]);
2121
$this->logFileDir = implode('/', $pathParts);
22-
if (!file_exists($this->logFileDir)) {
22+
if (! file_exists($this->logFileDir)) {
2323
mkdir($this->logFileDir);
2424
}
2525
}

src/CacheServer/ActionHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function __invoke(
1616
): ?bool {
1717
$action = $data['action'];
1818
$functionName = 'handle'.ucfirst($action);
19-
if (!method_exists($this, $functionName)) {
19+
if (! method_exists($this, $functionName)) {
2020
return false;
2121
}
2222

@@ -48,7 +48,7 @@ private function handleGet(
4848
): bool {
4949
$key = $data['key'];
5050
$package = $server->getBucket()->get($key);
51-
if (!$package) {
51+
if (! $package) {
5252
return false;
5353
}
5454
if ($server->getEventListener()) {
@@ -67,7 +67,7 @@ private function handleDelete(
6767
): bool {
6868
$key = $data['key'];
6969
$package = $server->getBucket()->get($key);
70-
if (!$package) {
70+
if (! $package) {
7171
return false;
7272
}
7373
if ($server->getEventListener()) {

src/Commands/GetCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private function getEntry(InputInterface $input, OutputInterface $output)
4343
/* @var $client CacheClient */
4444
$client = $this->serviceManager->get(CacheClient::class);
4545
$table = (new Table($output))->setHeaders(['KEY', 'VALUE']);
46-
if (!is_null($key)) {
46+
if (! is_null($key)) {
4747
$value = $client->get($key);
4848
if ($value === false) {
4949
$output->writeln('<comment>No entry found for key: '.$key.'</comment>');

src/IO/CacheIOHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function createServerSocket()
4343
$socket = socket_create($socketType, SOCK_STREAM, 0);
4444
socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1);
4545
$bindResult = socket_bind($socket, $this->location, $this->serverPort);
46-
if (!$bindResult) {
46+
if (! $bindResult) {
4747
$errorCode = socket_last_error($socket);
4848
$errorMsg = socket_strerror($errorCode);
4949

@@ -73,7 +73,7 @@ public function createClientSocket()
7373
$this->location,
7474
$this->serverPort
7575
);
76-
if (!$connectionResult) {
76+
if (! $connectionResult) {
7777
$errorCode = socket_last_error($socket);
7878
$errorMsg = socket_strerror($errorCode);
7979

src/Storage/Bucket.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct(string $backupDir)
2020

2121
public function get(string $key): ?string
2222
{
23-
if (!array_key_exists($key, $this->entries) && !$this->existsInBackup($key)) {
23+
if (! array_key_exists($key, $this->entries) && ! $this->existsInBackup($key)) {
2424
return null;
2525
}
2626
if ($this->existsInBackup($key)) {
@@ -46,7 +46,7 @@ private function getFromBackup($key): string
4646
$contents = '';
4747
$handle = fopen($this->backupDir.'/'.$key.'.dat', 'r+');
4848
if (is_resource($handle)) {
49-
while (!feof($handle)) {
49+
while (! feof($handle)) {
5050
$contents .= fread($handle, 32);
5151
}
5252
}
@@ -59,7 +59,7 @@ public function store(string $key, string $entry, $time = null): bool
5959
$compressed = gzcompress($entry, 9);
6060
$this->entries[$key]['content'] = $compressed;
6161
$this->entries[$key]['created_time'] = is_null($time) ? time() : $time;
62-
if (!$compressed) {
62+
if (! $compressed) {
6363
return false;
6464
}
6565

src/Storage/BucketFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function __invoke(\Psr\Container\ContainerInterface $container)
1414
$config = $container->getConfig();
1515
$backupDir = $config['backupDir'];
1616
$bucket = new Bucket($backupDir);
17-
if (!file_exists($backupDir)) {
17+
if (! file_exists($backupDir)) {
1818
return $bucket;
1919
}
2020

@@ -24,12 +24,12 @@ public function __invoke(\Psr\Container\ContainerInterface $container)
2424
private function restoreFromBackup($bucket, $backupDir)
2525
{
2626
foreach (new \DirectoryIterator($backupDir) as $file) {
27-
if (!$file->isDot() && $file->isFile()) {
27+
if (! $file->isDot() && $file->isFile()) {
2828
$keyParts = explode('.', $file->getFilename());
2929
$key = $keyParts[0];
3030
$handle = $file->openFile('r');
3131
$contents = '';
32-
while (!$handle->eof()) {
32+
while (! $handle->eof()) {
3333
$contents .= $handle->fread(128);
3434
}
3535
if ($contents != '') {

src/Storage/Maintainer.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,18 @@ private function free(Bucket $bucket): void
7878

7979
private function createBackupDir(): void
8080
{
81-
if (!file_exists($this->backupDir)) {
81+
if (! file_exists($this->backupDir)) {
8282
mkdir($this->backupDir);
8383
}
8484
}
8585

8686
private function backupToFile(Bucket $bucket): void
8787
{
8888
foreach ($bucket->getEntries() as $key => $entry) {
89-
file_put_contents($this->backupDir.'/'.$key.'.dat',
90-
serialize($entry));
89+
file_put_contents(
90+
$this->backupDir.'/'.$key.'.dat',
91+
serialize($entry)
92+
);
9193
}
9294
}
9395
}

0 commit comments

Comments
 (0)