diff --git a/composer.json b/composer.json
index a9ca75f..081da7f 100644
--- a/composer.json
+++ b/composer.json
@@ -18,15 +18,15 @@
],
"require": {
"php": ">=8.0",
- "laminas/laminas-diagnostics": "^1.8",
+ "laminas/laminas-diagnostics": "^1.24",
"pimcore/pimcore": "^10.0"
},
"require-dev": {
- "deployer/deployer": "^7.0",
- "phpstan/phpstan": "^0.12",
- "phpstan/phpstan-symfony": "^0.12",
+ "deployer/deployer": "^7.1",
+ "phpstan/phpstan": "^1.9",
+ "phpstan/phpstan-symfony": "^1.2",
"roave/security-advisories": "dev-latest",
- "symplify/easy-coding-standard": "^9.0"
+ "symplify/easy-coding-standard": "^11.2"
},
"autoload": {
"psr-4": {
diff --git a/src/PimcoreMonitorBundle/Check/AppEnvironment.php b/src/PimcoreMonitorBundle/Check/AppEnvironment.php
index ccef5ad..d0e36f1 100644
--- a/src/PimcoreMonitorBundle/Check/AppEnvironment.php
+++ b/src/PimcoreMonitorBundle/Check/AppEnvironment.php
@@ -26,14 +26,7 @@ class AppEnvironment extends AbstractCheck
{
protected const IDENTIFIER = 'system:app_environment';
- protected bool $skip;
- protected string $environment;
-
- public function __construct(bool $skip, string $environment)
- {
- $this->skip = $skip;
- $this->environment = $environment;
- }
+ public function __construct(protected bool $skip, protected string $environment) {}
/**
* {@inheritDoc}
diff --git a/src/PimcoreMonitorBundle/Check/DiskUsage.php b/src/PimcoreMonitorBundle/Check/DiskUsage.php
index 148c20a..c06b406 100644
--- a/src/PimcoreMonitorBundle/Check/DiskUsage.php
+++ b/src/PimcoreMonitorBundle/Check/DiskUsage.php
@@ -27,18 +27,12 @@ class DiskUsage extends AbstractCheck
{
protected const IDENTIFIER = 'device:disk_usage';
- protected bool $skip;
- protected int $warningThreshold;
- protected int $criticalThreshold;
- protected string $path;
-
- public function __construct(bool $skip, int $warningThreshold, int $criticalThreshold, string $path)
- {
- $this->skip = $skip;
- $this->warningThreshold = $warningThreshold;
- $this->criticalThreshold = $criticalThreshold;
- $this->path = $path;
- }
+ public function __construct(
+ protected bool $skip,
+ protected int $warningThreshold,
+ protected int $criticalThreshold,
+ protected string $path
+ ) {}
/**
* {@inheritDoc}
@@ -49,32 +43,26 @@ public function check(): ResultInterface
return new Skip('Check was skipped');
}
- $df = disk_free_space($this->path);
- $dt = disk_total_space($this->path);
+ $df = \disk_free_space($this->path);
+ $dt = \disk_total_space($this->path);
$du = $dt - $df;
$dp = ($du / $dt) * 100;
+ $data = [
+ 'used' => \formatBytes($du),
+ 'free' => \formatBytes($df),
+ 'total' => \formatBytes($dt),
+ ];
+
if ($dp >= $this->criticalThreshold) {
- return new Failure(sprintf('Disk usage too high: %2d%%', $dp), [
- 'used' => formatBytes($du),
- 'free' => formatBytes($df),
- 'total' => formatBytes($dt),
- ]);
+ return new Failure(\sprintf('Disk usage too high: %2d%%', $dp), $data);
}
if ($dp >= $this->warningThreshold) {
- return new Warning(sprintf('Disk usage high: %2d%%', $dp), [
- 'used' => formatBytes($du),
- 'free' => formatBytes($df),
- 'total' => formatBytes($dt),
- ]);
+ return new Warning(\sprintf('Disk usage high: %2d%%', $dp), $data);
}
- return new Success(sprintf('Disk usage is %2d%%', $dp), [
- 'used' => formatBytes($du),
- 'free' => formatBytes($df),
- 'total' => formatBytes($dt),
- ]);
+ return new Success(\sprintf('Disk usage is %2d%%', $dp), $data);
}
/**
diff --git a/src/PimcoreMonitorBundle/Check/DoctrineMigrations.php b/src/PimcoreMonitorBundle/Check/DoctrineMigrations.php
index 7f5e8fa..dee20c9 100644
--- a/src/PimcoreMonitorBundle/Check/DoctrineMigrations.php
+++ b/src/PimcoreMonitorBundle/Check/DoctrineMigrations.php
@@ -22,7 +22,6 @@
use Doctrine\Migrations\Metadata\AvailableMigration;
use Doctrine\Migrations\Metadata\ExecutedMigration;
use Doctrine\Migrations\Version\Version;
-use InvalidArgumentException;
use Laminas\Diagnostics\Result\Failure;
use Laminas\Diagnostics\Result\ResultInterface;
use Laminas\Diagnostics\Result\Skip;
@@ -32,8 +31,6 @@ class DoctrineMigrations extends AbstractCheck
{
protected const IDENTIFIER = 'system:doctrine_migrations';
- protected bool $skip;
-
/**
* Type depends on the installed version of doctrine/migrations:
* for ^2.0 it is string[], for ^3.0 it is Version[]
@@ -50,10 +47,8 @@ class DoctrineMigrations extends AbstractCheck
*/
protected array $migratedVersions;
- public function __construct(bool $skip, $input)
+ public function __construct(protected bool $skip, $input)
{
- $this->skip = $skip;
-
// check for doctrine/migrations:^3.0
if ($input instanceof DependencyFactory) {
$this->availableVersions = $this->getAvailableVersionsFromDependencyFactory($input);
@@ -63,15 +58,15 @@ public function __construct(bool $skip, $input)
// check for doctrine/migrations:^2.0
if ($input instanceof Configuration &&
- method_exists($input, 'getAvailableVersions') &&
- method_exists($input, 'getMigratedVersions')
+ \method_exists($input, 'getAvailableVersions') &&
+ \method_exists($input, 'getMigratedVersions')
) {
$this->availableVersions = $input->getAvailableVersions();
$this->migratedVersions = $input->getMigratedVersions();
return;
}
- throw new InvalidArgumentException(<<<'MESSAGE'
+ throw new \InvalidArgumentException(<<<'MESSAGE'
Invalid Argument for DoctrineMigration check.
If you are using doctrine/migrations ^3.0, pass Doctrine\Migrations\DependencyFactory as argument.
If you are using doctrine/migrations ^2.0, pass Doctrine\Migrations\Configuration\Configuration as argument.
@@ -88,25 +83,27 @@ public function check(): ResultInterface
return new Skip('Check was skipped');
}
- $notMigratedVersions = array_diff($this->availableVersions, $this->migratedVersions);
+ $notMigratedVersions = \array_diff($this->availableVersions, $this->migratedVersions);
+
if (! empty($notMigratedVersions)) {
return new Failure(
'Not all migrations applied',
- array_values(array_map('strval', $notMigratedVersions))
+ \array_values(\array_map('strval', $notMigratedVersions))
);
}
- $notAvailableVersions = array_diff($this->migratedVersions, $this->availableVersions);
+ $notAvailableVersions = \array_diff($this->migratedVersions, $this->availableVersions);
+
if (! empty($notAvailableVersions)) {
return new Failure(
'Migrations applied which are not available',
- array_values(array_map('strval', $notAvailableVersions))
+ \array_values(\array_map('strval', $notAvailableVersions))
);
}
return new Success(
'All migrations are correctly applied',
- array_values(array_map('strval', $this->migratedVersions))
+ \array_values(\array_map('strval', $this->migratedVersions))
);
}
@@ -125,9 +122,10 @@ private function getAvailableVersionsFromDependencyFactory(DependencyFactory $de
{
$allMigrations = $dependencyFactory->getMigrationRepository()->getMigrations();
- return array_map(static function (AvailableMigration $availableMigration) {
- return $availableMigration->getVersion();
- }, $allMigrations->getItems());
+ return \array_map(
+ static fn (AvailableMigration $availableMigration) => $availableMigration->getVersion(),
+ $allMigrations->getItems()
+ );
}
/**
@@ -137,8 +135,9 @@ private function getMigratedVersionsFromDependencyFactory(DependencyFactory $dep
{
$executedMigrations = $dependencyFactory->getMetadataStorage()->getExecutedMigrations();
- return array_map(static function (ExecutedMigration $executedMigration) {
- return $executedMigration->getVersion();
- }, $executedMigrations->getItems());
+ return \array_map(
+ static fn (ExecutedMigration $executedMigration) => $executedMigration->getVersion(),
+ $executedMigrations->getItems()
+ );
}
}
diff --git a/src/PimcoreMonitorBundle/Check/HostingSize.php b/src/PimcoreMonitorBundle/Check/HostingSize.php
index 38c73cb..8e7a01c 100644
--- a/src/PimcoreMonitorBundle/Check/HostingSize.php
+++ b/src/PimcoreMonitorBundle/Check/HostingSize.php
@@ -1,5 +1,20 @@
skip = $skip;
- $this->warningThreshold = $warningThreshold;
- $this->criticalThreshold = $criticalThreshold;
- $this->path = $path;
- }
+ public function __construct(
+ protected bool $skip,
+ protected int $warningThreshold,
+ protected int $criticalThreshold,
+ protected string $path
+ ) {}
/**
* {@inheritDoc}
@@ -35,25 +44,20 @@ public function check(): ResultInterface
}
$size = $this->getDirectorySize();
+ $data = [
+ 'path' => $this->path,
+ 'size' => \formatBytes($size),
+ ];
if ($size >= $this->criticalThreshold) {
- return new Failure(sprintf('Hosting size is too high: %s', formatBytes($size)), [
- 'path' => $this->path,
- 'size' => formatBytes($size),
- ]);
+ return new Failure(\sprintf('Hosting size is too high: %s', \formatBytes($size)), $data);
}
if ($size >= $this->warningThreshold) {
- return new Warning(sprintf('Hosting size is high: %s', formatBytes($size)), [
- 'path' => $this->path,
- 'size' => formatBytes($size),
- ]);
+ return new Warning(\sprintf('Hosting size is high: %s', \formatBytes($size)), $data);
}
- return new Success(sprintf('Hosting size is %s', formatBytes($size)), [
- 'path' => $this->path,
- 'size' => formatBytes($size),
- ]);
+ return new Success(sprintf('Hosting size is %s', \formatBytes($size)), $data);
}
/**
@@ -69,10 +73,10 @@ public function getLabel(): string
*/
private function getDirectorySize(): int
{
- $io = popen('/usr/bin/du -sk ' . $this->path, 'r');
- $size = fgets($io, 4096);
- $size = (int) substr($size, 0, strpos($size, "\t"));
- pclose($io);
+ $io = \popen('/usr/bin/du -sk ' . $this->path, 'r');
+ $size = \fgets($io, 4096);
+ $size = (int) \substr($size, 0, \strpos($size, "\t"));
+ \pclose($io);
return $size * 1024;
}
diff --git a/src/PimcoreMonitorBundle/Check/HttpsConnection.php b/src/PimcoreMonitorBundle/Check/HttpsConnection.php
index d796d87..0e030c2 100644
--- a/src/PimcoreMonitorBundle/Check/HttpsConnection.php
+++ b/src/PimcoreMonitorBundle/Check/HttpsConnection.php
@@ -1,5 +1,20 @@
skip = $skip;
- $this->systemConfig = $systemConfig;
- }
+ public function __construct(protected bool $skip, protected array $systemConfig) {}
/**
* {@inheritDoc}
@@ -37,15 +45,15 @@ public function check(): ResultInterface
}
// Create a stream context
- $stream = stream_context_create(['ssl' => ['capture_peer_cert' => true]]);
- $url = sprintf('https://%s', $host);
+ $stream = \stream_context_create(['ssl' => ['capture_peer_cert' => true]]);
+ $url = \sprintf('https://%s', $host);
try {
// Bind the resource $url to $stream
- $read = fopen($url, 'rb', false, $stream);
+ $read = \fopen($url, 'rb', false, $stream);
// Get the stream parameters
- $params = stream_context_get_params($read);
+ $params = \stream_context_get_params($read);
} catch (\Exception) {
// Ignore exceptions thrown ...
}
diff --git a/src/PimcoreMonitorBundle/Check/MySqlVersion.php b/src/PimcoreMonitorBundle/Check/MySqlVersion.php
index 4190617..0be3678 100644
--- a/src/PimcoreMonitorBundle/Check/MySqlVersion.php
+++ b/src/PimcoreMonitorBundle/Check/MySqlVersion.php
@@ -1,29 +1,38 @@
skip = $skip;
- $this->version = $expectedVersion;
- $this->operator = $operator;
- $this->db = $db;
- }
+ public function __construct(
+ protected bool $skip,
+ protected string $expectedVersion,
+ protected string $operator,
+ protected Connection $connection
+ ) {}
/**
* {@inheritDoc}
@@ -35,17 +44,17 @@ public function check(): ResultInterface
}
try {
- $mysqlVersion = $this->db->fetchOne('SELECT VERSION()');
+ $mysqlVersion = $this->connection->fetchOne('SELECT VERSION()');
} catch (\Exception) {
$mysqlVersion = null;
}
- if (! version_compare($mysqlVersion, $this->version, $this->operator)) {
- return new Failure(sprintf(
+ if (! \version_compare($mysqlVersion, $this->expectedVersion, $this->operator)) {
+ return new Failure(\sprintf(
'Current MySQL version is %s, expected %s %s',
$mysqlVersion,
$this->operator,
- $this->version
+ $this->expectedVersion
), $mysqlVersion);
}
diff --git a/src/PimcoreMonitorBundle/Check/PhpVersion.php b/src/PimcoreMonitorBundle/Check/PhpVersion.php
index f86acf5..f9ca1c4 100644
--- a/src/PimcoreMonitorBundle/Check/PhpVersion.php
+++ b/src/PimcoreMonitorBundle/Check/PhpVersion.php
@@ -26,16 +26,7 @@ class PhpVersion extends AbstractCheck
{
protected const IDENTIFIER = 'system:php_version';
- protected bool $skip;
- protected string $version;
- protected string $operator;
-
- public function __construct(bool $skip, string $expectedVersion, string $operator)
- {
- $this->skip = $skip;
- $this->version = $expectedVersion;
- $this->operator = $operator;
- }
+ public function __construct(protected bool $skip, protected string $expectedVersion, protected string $operator) {}
/**
* {@inheritDoc}
@@ -46,12 +37,12 @@ public function check(): ResultInterface
return new Skip('Check was skipped');
}
- if (! version_compare(PHP_VERSION, $this->version, $this->operator)) {
- return new Failure(sprintf(
+ if (! \version_compare(PHP_VERSION, $this->expectedVersion, $this->operator)) {
+ return new Failure(\sprintf(
'Current PHP version is %s, expected %s %s',
PHP_VERSION,
$this->operator,
- $this->version
+ $this->expectedVersion
), PHP_VERSION);
}
diff --git a/src/PimcoreMonitorBundle/Check/PimcoreAreabricks.php b/src/PimcoreMonitorBundle/Check/PimcoreAreabricks.php
index 6f3de94..5a30303 100644
--- a/src/PimcoreMonitorBundle/Check/PimcoreAreabricks.php
+++ b/src/PimcoreMonitorBundle/Check/PimcoreAreabricks.php
@@ -26,14 +26,7 @@ class PimcoreAreabricks extends AbstractCheck
{
protected const IDENTIFIER = 'pimcore:areabricks';
- protected bool $skip;
- protected AreabrickManagerInterface $areabrickManager;
-
- public function __construct(bool $skip, AreabrickManagerInterface $areabrickManager)
- {
- $this->skip = $skip;
- $this->areabrickManager = $areabrickManager;
- }
+ public function __construct(protected bool $skip, protected AreabrickManagerInterface $areabrickManager) {}
public function check(): ResultInterface
{
@@ -52,7 +45,7 @@ public function check(): ResultInterface
];
}
- return new Success(sprintf('There are %s Areabricks in the system', \count($bricks)), $bricks);
+ return new Success(\sprintf('There are %s Areabricks in the system', \count($bricks)), $bricks);
}
public function getLabel(): string
diff --git a/src/PimcoreMonitorBundle/Check/PimcoreBundles.php b/src/PimcoreMonitorBundle/Check/PimcoreBundles.php
index 75b7fdf..4ded6c1 100644
--- a/src/PimcoreMonitorBundle/Check/PimcoreBundles.php
+++ b/src/PimcoreMonitorBundle/Check/PimcoreBundles.php
@@ -26,14 +26,7 @@ class PimcoreBundles extends AbstractCheck
{
protected const IDENTIFIER = 'pimcore:bundles';
- protected bool $skip;
- protected PimcoreBundleManager $pimcoreBundleManager;
-
- public function __construct(bool $skip, PimcoreBundleManager $pimcoreBundleManager)
- {
- $this->skip = $skip;
- $this->pimcoreBundleManager = $pimcoreBundleManager;
- }
+ public function __construct(protected bool $skip, protected PimcoreBundleManager $pimcoreBundleManager) {}
public function check(): ResultInterface
{
@@ -53,7 +46,7 @@ public function check(): ResultInterface
];
}
- return new Success(sprintf('There are %s Pimcore bundles in the system', \count($bundles)), $bundles);
+ return new Success(\sprintf('There are %s Pimcore bundles in the system', \count($bundles)), $bundles);
}
public function getLabel(): string
diff --git a/src/PimcoreMonitorBundle/Check/PimcoreElementCount.php b/src/PimcoreMonitorBundle/Check/PimcoreElementCount.php
index a94ad81..bc13747 100644
--- a/src/PimcoreMonitorBundle/Check/PimcoreElementCount.php
+++ b/src/PimcoreMonitorBundle/Check/PimcoreElementCount.php
@@ -17,6 +17,7 @@
namespace Wvision\Bundle\PimcoreMonitorBundle\Check;
+use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\Exception as DBALDriverException;
use Doctrine\DBAL\Exception as DBALException;
use Laminas\Diagnostics\Result\Failure;
@@ -24,24 +25,17 @@
use Laminas\Diagnostics\Result\Skip;
use Laminas\Diagnostics\Result\Success;
use Laminas\Diagnostics\Result\Warning;
-use Pimcore\Db\ConnectionInterface;
class PimcoreElementCount extends AbstractCheck
{
protected const IDENTIFIER = 'pimcore:element_count';
- protected bool $skip;
- protected int $warningThreshold;
- protected int $criticalThreshold;
- protected ConnectionInterface $connection;
-
- public function __construct(bool $skip, int $warningThreshold, int $criticalThreshold, ConnectionInterface $connection)
- {
- $this->skip = $skip;
- $this->warningThreshold = $warningThreshold;
- $this->criticalThreshold = $criticalThreshold;
- $this->connection = $connection;
- }
+ public function __construct(
+ protected bool $skip,
+ protected int $warningThreshold,
+ protected int $criticalThreshold,
+ protected Connection $connection
+ ) {}
public function check(): ResultInterface
{
@@ -54,30 +48,22 @@ public function check(): ResultInterface
$objectCount = $this->getTableRowCount('objects', 'o_id');
$totalCount = $documentCount + $assetCount + $objectCount;
+ $data = [
+ 'documents' => $documentCount,
+ 'assets' => $assetCount,
+ 'objects' => $objectCount,
+ 'total' => $totalCount,
+ ];
+
if ($totalCount >= $this->criticalThreshold) {
- return new Failure(sprintf('Element count too high: %s', $totalCount), [
- 'documents' => $documentCount,
- 'assets' => $assetCount,
- 'objects' => $objectCount,
- 'total' => $totalCount,
- ]);
+ return new Failure(\sprintf('Element count too high: %s', $totalCount), $data);
}
if ($totalCount >= $this->warningThreshold) {
- return new Warning(sprintf('Element count high: %s', $totalCount), [
- 'documents' => $documentCount,
- 'assets' => $assetCount,
- 'objects' => $objectCount,
- 'total' => $totalCount,
- ]);
+ return new Warning(\sprintf('Element count high: %s', $totalCount), $data);
}
- return new Success(sprintf('There are %s Pimcore elements in the system', $totalCount), [
- 'documents' => $documentCount,
- 'assets' => $assetCount,
- 'objects' => $objectCount,
- 'total' => $totalCount,
- ]);
+ return new Success(\sprintf('There are %s Pimcore elements in the system', $totalCount), $data);
}
public function getLabel(): string
@@ -93,7 +79,7 @@ protected function getTableRowCount(string $tableName, string $idColumn): int
try {
$count = $qb->execute()->fetchOne();
- } catch (DBALException | DBALDriverException $e) {
+ } catch (DBALException | DBALDriverException) {
$count = 0;
}
diff --git a/src/PimcoreMonitorBundle/Check/PimcoreMaintenance.php b/src/PimcoreMonitorBundle/Check/PimcoreMaintenance.php
index 9894100..21801ff 100644
--- a/src/PimcoreMonitorBundle/Check/PimcoreMaintenance.php
+++ b/src/PimcoreMonitorBundle/Check/PimcoreMaintenance.php
@@ -28,14 +28,7 @@ class PimcoreMaintenance extends AbstractCheck
{
protected const IDENTIFIER = 'pimcore:maintenance';
- protected bool $skip;
- protected ExecutorInterface $maintenanceExecutor;
-
- public function __construct(bool $skip, ExecutorInterface $maintenanceExecutor)
- {
- $this->skip = $skip;
- $this->maintenanceExecutor = $maintenanceExecutor;
- }
+ public function __construct(protected bool $skip, protected ExecutorInterface $maintenanceExecutor) {}
/**
* {@inheritDoc}
@@ -54,7 +47,7 @@ public function check(): ResultInterface
];
// Maintenance script should run at least every hour + a little tolerance
- if ($lastExecution && (time() - $lastExecution) < 3660) {
+ if ($lastExecution && (\time() - $lastExecution) < 3660) {
$data['active'] = true;
return new Success('Pimcore maintenance is activated', $data);
diff --git a/src/PimcoreMonitorBundle/Check/PimcoreUsers.php b/src/PimcoreMonitorBundle/Check/PimcoreUsers.php
index 3976586..4bfc6fd 100644
--- a/src/PimcoreMonitorBundle/Check/PimcoreUsers.php
+++ b/src/PimcoreMonitorBundle/Check/PimcoreUsers.php
@@ -27,12 +27,7 @@ class PimcoreUsers extends AbstractCheck
{
protected const IDENTIFIER = 'pimcore:users';
- protected bool $skip;
-
- public function __construct(bool $skip)
- {
- $this->skip = $skip;
- }
+ public function __construct(protected bool $skip) {}
/**
* {@inheritDoc}
@@ -62,7 +57,7 @@ public function check(): ResultInterface
];
}
- return new Success(sprintf('There are %s Pimcore users in the system', \count($users)), $users);
+ return new Success(\sprintf('There are %s Pimcore users in the system', \count($users)), $users);
}
/**
diff --git a/src/PimcoreMonitorBundle/Check/PimcoreVersion.php b/src/PimcoreMonitorBundle/Check/PimcoreVersion.php
index f525e25..7c2644d 100644
--- a/src/PimcoreMonitorBundle/Check/PimcoreVersion.php
+++ b/src/PimcoreMonitorBundle/Check/PimcoreVersion.php
@@ -26,12 +26,7 @@ class PimcoreVersion extends AbstractCheck
{
protected const IDENTIFIER = 'pimcore:version';
- protected bool $skip;
-
- public function __construct(bool $skip)
- {
- $this->skip = $skip;
- }
+ public function __construct(protected bool $skip) {}
/**
* {@inheritDoc}
@@ -42,11 +37,12 @@ public function check(): ResultInterface
return new Skip('Check was skipped');
}
- $version = InstalledVersions::getPrettyVersion('pimcore/pimcore');
+ $packageName = 'pimcore/pimcore';
+ $version = InstalledVersions::getPrettyVersion($packageName);
- return new Success(sprintf('The system is running on Pimcore %s', $version), [
+ return new Success(\sprintf('The system is running on Pimcore %s', $version), [
'semver' => $version,
- 'reference' => InstalledVersions::getReference('pimcore/pimcore'),
+ 'reference' => InstalledVersions::getReference($packageName),
]);
}
diff --git a/src/PimcoreMonitorBundle/Command/HealthCheckCommand.php b/src/PimcoreMonitorBundle/Command/HealthCheckCommand.php
index 1b02409..b026d47 100644
--- a/src/PimcoreMonitorBundle/Command/HealthCheckCommand.php
+++ b/src/PimcoreMonitorBundle/Command/HealthCheckCommand.php
@@ -27,13 +27,9 @@ class HealthCheckCommand extends Command
{
protected static $defaultName = 'pimcore:monitor:health-check';
- private RunnerManager $runnerManager;
-
- public function __construct(RunnerManager $runnerManager)
+ public function __construct(private RunnerManager $runnerManager)
{
parent::__construct();
-
- $this->runnerManager = $runnerManager;
}
protected function execute(InputInterface $input, OutputInterface $output): int
diff --git a/src/PimcoreMonitorBundle/Command/HealthReportCommand.php b/src/PimcoreMonitorBundle/Command/HealthReportCommand.php
index 1e9a62b..5933200 100644
--- a/src/PimcoreMonitorBundle/Command/HealthReportCommand.php
+++ b/src/PimcoreMonitorBundle/Command/HealthReportCommand.php
@@ -34,30 +34,15 @@ class HealthReportCommand extends Command
{
protected static $defaultName = 'pimcore:monitor:health-report';
- private string $reportEndpoint;
- private string $apiKey;
- private array $pimcoreSystemConfig;
- private string $secret;
- private HttpClientInterface $httpClient;
- private RunnerManager $runnerManager;
-
public function __construct(
- string $reportEndpoint,
- string $apiKey,
- array $pimcoreSystemConfig,
- string $secret,
- HttpClientInterface $httpClient,
- RunnerManager $runnerManager
+ private string $reportEndpoint,
+ private string $apiKey,
+ private array $pimcoreSystemConfig,
+ private string $secret,
+ private HttpClientInterface $httpClient,
+ private RunnerManager $runnerManager
) {
- $this->reportEndpoint = $reportEndpoint;
-
parent::__construct();
-
- $this->apiKey = $apiKey;
- $this->pimcoreSystemConfig = $pimcoreSystemConfig;
- $this->secret = $secret;
- $this->httpClient = $httpClient;
- $this->runnerManager = $runnerManager;
}
protected function configure(): void
@@ -126,15 +111,21 @@ protected function execute(InputInterface $input, OutputInterface $output): int
],
]);
$payload = $response->toArray();
- } catch (TransportExceptionInterface | ClientExceptionInterface | DecodingExceptionInterface | RedirectionExceptionInterface | ServerExceptionInterface $e) {
+ } catch (
+ TransportExceptionInterface |
+ ClientExceptionInterface |
+ DecodingExceptionInterface |
+ RedirectionExceptionInterface |
+ ServerExceptionInterface $e
+ ) {
$output->writeln(
- sprintf('