Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Jun 5, 2024
1 parent 1ce9ced commit 79ba4cd
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion lib/Activity/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(IFactory $languageFactory, IURLGenerator $urlGenerat
$this->urlGenerator = $urlGenerator;
}

public function parse($language, IEvent $event, IEvent $previousEvent = null) {
public function parse($language, IEvent $event, ?IEvent $previousEvent = null) {
if ($event->getApp() !== Application::APP_NAME || $event->getType() !== self::TYPE_VIRUS_DETECTED) {
throw new \InvalidArgumentException();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/AvirWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function fopen($path, $mode) {
return $stream;
}

public function writeStream(string $path, $stream, int $size = null): int {
public function writeStream(string $path, $stream, ?int $size = null): int {
if ($this->shouldWrap($path)) {
$stream = $this->wrapSteam($path, $stream);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Command/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$details = $result->getDetails();
$output->writeln("<error>❌ $details</error>");
return 1;
} else if ($result->getNumericStatus() === Status::SCANRESULT_UNCHECKED) {
} elseif ($result->getNumericStatus() === Status::SCANRESULT_UNCHECKED) {
$output->writeln("<comment>- file not scanned or scan still pending</comment>");
} else {
$output->writeln("<info>✓</info>");
Expand All @@ -92,7 +92,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$details = $result->getDetails();
$output->writeln("<error>❌ file not detected $details</error>");
return 1;
} else if ($result->getNumericStatus() === Status::SCANRESULT_UNCHECKED) {
} elseif ($result->getNumericStatus() === Status::SCANRESULT_UNCHECKED) {
$output->writeln("<comment>- file not scanned or scan still pending</comment>");
} else {
$output->writeln("<info>✓</info>");
Expand All @@ -113,7 +113,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$details = $result->getDetails();
$output->writeln("<error>❌ file not detected $details</error>");
return 1;
} else if ($result->getNumericStatus() === Status::SCANRESULT_UNCHECKED) {
} elseif ($result->getNumericStatus() === Status::SCANRESULT_UNCHECKED) {
$output->writeln("<comment>- file not scanned or scan still pending</comment>");
} else {
$output->writeln("<info>✓</info>");
Expand Down
8 changes: 4 additions & 4 deletions lib/Controller/RuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

namespace OCA\Files_Antivirus\Controller;

use \OCA\Files_Antivirus\Db\Rule;
use \OCA\Files_Antivirus\Db\RuleMapper;
use \OCP\AppFramework\Controller;
use OCA\Files_Antivirus\Db\Rule;
use OCA\Files_Antivirus\Db\RuleMapper;
use OCP\AppFramework\Controller;

use \OCP\IRequest;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;

class RuleController extends Controller {
/** @var RuleMapper */
Expand Down
12 changes: 6 additions & 6 deletions lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

namespace OCA\Files_Antivirus\Controller;

use \OCA\Files_Antivirus\AppConfig;
use \OCP\AppFramework\Controller;
use \OCP\AppFramework\Http\JSONResponse;
use \OCP\IL10N;
use \OCP\IRequest;
use OCA\Files_Antivirus\AppConfig;
use OCA\Files_Antivirus\Scanner\ScannerFactory;

use OCA\Files_Antivirus\Status;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IL10N;

use OCP\IRequest;

class SettingsController extends Controller {
/**
Expand Down
2 changes: 1 addition & 1 deletion lib/ICAP/ICAPRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(
array $headers,
array $requestHeaders,
array $responseHeaders,
callable $responseCallback = null
?callable $responseCallback = null
) {
$this->stream = $stream;
$this->responseCallback = $responseCallback;
Expand Down
2 changes: 1 addition & 1 deletion lib/ICAP/ResponseParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

namespace OCA\Files_Antivirus\ICAP;

use \RuntimeException;
use RuntimeException;

class ResponseParser {
/**
Expand Down
6 changes: 3 additions & 3 deletions lib/Scanner/ICAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
use OCA\Files_Antivirus\Status;
use OCA\Files_Antivirus\StatusFactory;
use OCP\ICertificateManager;
use OCP\IRequest;
use Psr\Log\LoggerInterface;

class ICAP extends ScannerBase {
Expand Down Expand Up @@ -133,8 +132,9 @@ protected function scanBuffer() {
if (\strpos($respHeader, '403 Forbidden') || \strpos($respHeader, '403 VirusFound')) {
$this->status->setNumericStatus(Status::SCANRESULT_INFECTED);
}
} else if ($code === 202) {
$this->status->setNumericStatus(Status::SCANRESULT_UNCHECKED);;
} elseif ($code === 202) {
$this->status->setNumericStatus(Status::SCANRESULT_UNCHECKED);
;
} else {
throw new \RuntimeException('Invalid response from ICAP server');
}
Expand Down
1 change: 0 additions & 1 deletion lib/Scanner/ScannerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

use OCA\Files_Antivirus\AppConfig;
use OCP\IRequest;
use OCP\IServerContainer;
use Psr\Container\ContainerInterface;

class ScannerFactory {
Expand Down

0 comments on commit 79ba4cd

Please sign in to comment.