Quality of life. Removing a lot of requirements etc
This commit is contained in:
@ -24,12 +24,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^10.3.5",
|
||||
"phpmetrics/phpmetrics": "^3.0-dev",
|
||||
"rector/rector": "^1.0",
|
||||
"vimeo/psalm": "dev-master",
|
||||
"phpmd/phpmd": "^2.15",
|
||||
"phpstan/phpstan": "^1.10",
|
||||
"squizlabs/php_codesniffer": "^3.9"
|
||||
"phpmetrics/phpmetrics": "^3.0-dev"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "vendor/bin/phpunit tests --display-warnings",
|
||||
|
2875
composer.lock
generated
2875
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,7 @@ use Nette\Schema\Expect;
|
||||
/**
|
||||
* Mostly working as a register pattern for the logging and configuration.
|
||||
*/
|
||||
class App
|
||||
final class App
|
||||
{
|
||||
/// Logging instance
|
||||
protected Logger $logger;
|
||||
@ -27,7 +27,7 @@ class App
|
||||
*
|
||||
* @param string $configFile Relative or full path to YML config.
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.StaticAccess)
|
||||
* @SuppressWarnings("PHPMD.StaticAccess")
|
||||
*/
|
||||
public function __construct(string $configFile)
|
||||
{
|
||||
|
@ -20,8 +20,9 @@ use DateTime;
|
||||
name: 'backup',
|
||||
description: 'Start backup to assigned buckets',
|
||||
)]
|
||||
class CommandBackup extends Command
|
||||
final class CommandBackup extends Command
|
||||
{
|
||||
#[\Override]
|
||||
protected function configure(): void
|
||||
{
|
||||
$this->addArgument(
|
||||
@ -43,6 +44,7 @@ class CommandBackup extends Command
|
||||
* 5. Send push notifications.
|
||||
* 3. Report final success
|
||||
*/
|
||||
#[\Override]
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$sio = new SymfonyStyle($input, $output);
|
||||
|
@ -15,8 +15,9 @@ use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
name: 'show',
|
||||
description: 'Show all backup entries.',
|
||||
)]
|
||||
class CommandShow extends Command
|
||||
final class CommandShow extends Command
|
||||
{
|
||||
#[\Override]
|
||||
protected function configure(): void
|
||||
{
|
||||
$this->addArgument(
|
||||
@ -31,6 +32,7 @@ class CommandShow extends Command
|
||||
* 2. For each configured backup print the details
|
||||
* 3. Exit
|
||||
*/
|
||||
#[\Override]
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$sio = new SymfonyStyle($input, $output);
|
||||
|
@ -7,7 +7,7 @@ namespace App\Notification;
|
||||
use App\Notification\Ntfy;
|
||||
use Psr\Log\NullLogger;
|
||||
|
||||
class Notification
|
||||
final class Notification
|
||||
{
|
||||
/**
|
||||
* @var NotificationInterface[] $notifiers
|
||||
|
@ -12,7 +12,7 @@ use InvalidArgumentException;
|
||||
/**
|
||||
* Send a notification through a ntfy server
|
||||
*/
|
||||
class Ntfy implements NotificationInterface
|
||||
final class Ntfy implements NotificationInterface
|
||||
{
|
||||
public const int TOPIC_MAX_LENGTH = 256;
|
||||
public const int TITLE_MAX_LENGTH = 256;
|
||||
@ -26,6 +26,7 @@ class Ntfy implements NotificationInterface
|
||||
*
|
||||
* @param string[] $config Configuration
|
||||
*/
|
||||
#[\Override]
|
||||
public static function factory(array $config): self
|
||||
{
|
||||
$instance = new self(new Client(new Server($config['domain'])));
|
||||
@ -64,6 +65,7 @@ class Ntfy implements NotificationInterface
|
||||
/**
|
||||
* Push a message with Ntfy
|
||||
*/
|
||||
#[\Override]
|
||||
public function send(string $title, string $message): void
|
||||
{
|
||||
if (! strlen($title) || strlen($title) > self::TITLE_MAX_LENGTH) {
|
||||
|
@ -16,7 +16,7 @@ use Exception;
|
||||
* Configuration of the mounts must be done before use.
|
||||
* Tested using rclone v1.64.0
|
||||
*/
|
||||
class Rclone
|
||||
final class Rclone
|
||||
{
|
||||
private const int MAX_RUNTIME = 4 * 3600; //4 hours maximum
|
||||
protected string $version = "";
|
||||
|
@ -8,7 +8,7 @@ use Twig\Environment;
|
||||
use Twig\Loader\ArrayLoader;
|
||||
use App\Template\TwigExtension;
|
||||
|
||||
class Twig extends Environment
|
||||
final class Twig extends Environment
|
||||
{
|
||||
/**
|
||||
* @param string[] $templates Array of templates
|
||||
|
@ -13,13 +13,14 @@ use Twig\TwigFilter;
|
||||
*
|
||||
* Additional formatters for templates
|
||||
*/
|
||||
class TwigExtension extends AbstractExtension
|
||||
final class TwigExtension extends AbstractExtension
|
||||
{
|
||||
/**
|
||||
* Extend the filters
|
||||
*
|
||||
* @return TwigFilter[]
|
||||
*/
|
||||
#[\Override]
|
||||
public function getFilters(): array
|
||||
{
|
||||
return [
|
||||
|
@ -13,6 +13,7 @@ use App\CommandBackup;
|
||||
#[CoversClass(CommandBackup::class)]
|
||||
final class CommandBackupTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
#[\Override]
|
||||
protected function setUp(): void
|
||||
{
|
||||
if (! is_dir('temp')) {
|
||||
@ -24,6 +25,7 @@ final class CommandBackupTest extends \PHPUnit\Framework\TestCase
|
||||
exec('rclone test makefiles --files 10 temp/source 2>&1');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
protected function tearDown(): void
|
||||
{
|
||||
exec('rclone purge temp 2>&1');
|
||||
|
@ -22,6 +22,7 @@ final class NtfyTest extends TestCase
|
||||
*/
|
||||
private MockObject $client;
|
||||
|
||||
#[\Override]
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->client = $this->createMock(Client::class);
|
||||
@ -29,7 +30,7 @@ final class NtfyTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.StaticAccess)
|
||||
* @SuppressWarnings("PHPMD.StaticAccess")
|
||||
*/
|
||||
public function testFactory(): void
|
||||
{
|
||||
|
@ -10,11 +10,13 @@ use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class RcloneTest extends TestCase
|
||||
{
|
||||
#[\Override]
|
||||
protected function setUp(): void
|
||||
{
|
||||
exec('rclone test makefiles temp/source 2>&1');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
protected function tearDown(): void
|
||||
{
|
||||
exec('rclone purge temp 2>&1');
|
||||
|
Reference in New Issue
Block a user