Support for PHP infection testing
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2023-11-03 13:29:50 +00:00
parent 66ccb3d8d6
commit bedc666f7c
11 changed files with 115 additions and 30 deletions

View File

@ -14,8 +14,9 @@ use InvalidArgumentException;
*/
class Ntfy implements NotificationInterface
{
const TOPIC_MAX_LENGTH = 256;
const MESSAGE_MAX_LENGTH = 4096;
public const TOPIC_MAX_LENGTH = 256;
public const TITLE_MAX_LENGTH = 256;
public const MESSAGE_MAX_LENGTH = 4096;
private string $topic = 'default';
/**
@ -68,7 +69,7 @@ class Ntfy implements NotificationInterface
*/
public function send(string $title, string $message): void
{
if (!strlen($title) || strlen($title) > self::TOPIC_MAX_LENGTH) {
if (!strlen($title) || strlen($title) > self::TITLE_MAX_LENGTH) {
throw new InvalidArgumentException("Invalid title length");
}

View File

@ -18,6 +18,7 @@ use Exception;
*/
class Rclone
{
private const MAX_RUNTIME = 4 * 3600; //4 hours maximum
protected string $version = "";
/**
@ -107,7 +108,7 @@ class Rclone
*
* @return Process Instance.
*/
protected function exec(string $command, array $options = array()): Process
private function exec(string $command, array $options = array()): Process
{
$process = new Process(
array_merge(
@ -119,7 +120,7 @@ class Rclone
$this->logger->info("Execute command", [$process->getCommandLine()]);
$process->setTimeout(4 * 3600);
$process->setTimeout(self::MAX_RUNTIME);
$process->run();
// executes after the command finishes