update libraries and run php-cs-fixer.

This commit is contained in:
Yoshihiro OKUMURA 2024-01-30 18:35:21 +09:00
parent b2617cd48c
commit 0e188c0380
8 changed files with 440 additions and 628 deletions

View File

@ -15,15 +15,15 @@
} }
}, },
"require": { "require": {
"php": ">=8.0", "php": ">=8.2",
"ext-json": "*", "ext-json": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
"ext-rrd": "*", "ext-rrd": "*",
"phpmailer/phpmailer": "^6.6", "phpmailer/phpmailer": "^6.9",
"twig/twig": "^3.4" "twig/twig": "^3.8"
}, },
"require-dev": { "require-dev": {
"friendsofphp/php-cs-fixer": "^3.8" "friendsofphp/php-cs-fixer": "^3.48"
}, },
"license": "MIT", "license": "MIT",
"authors": [ "authors": [

967
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -58,8 +58,6 @@ class Address
/** /**
* check wheter string is email. * check wheter string is email.
* *
* @param string $text email
*
* @return bool false if not email string * @return bool false if not email string
*/ */
public function validateEmail(string $email): bool public function validateEmail(string $email): bool

View File

@ -9,7 +9,6 @@ class UTF8_Mailer
/** /**
* send mail. * send mail.
* *
* @param Address $form from email address
* @param array $tos to email addresses * @param array $tos to email addresses
* @param string $subject subject * @param string $subject subject
* @param string $body mail body * @param string $body mail body

View File

@ -6,8 +6,8 @@ require_once APPDIR.'/vendor/autoload.php';
$config = json_decode(file_get_contents(APPDIR.'/etc/config.json'), true); $config = json_decode(file_get_contents(APPDIR.'/etc/config.json'), true);
$digitemp = new \Orrisroot\DigiTemp($config['digitemp'], APPDIR.'/'.$config['digitemp_config']); $digitemp = new Orrisroot\DigiTemp($config['digitemp'], APPDIR.'/'.$config['digitemp_config']);
$rrdtemp = new \Orrisroot\Rrd\Temperature(APPDIR.'/'.$config['database_dir']); $rrdtemp = new Orrisroot\Rrd\Temperature(APPDIR.'/'.$config['database_dir']);
$num = $digitemp->getNumSensors(); $num = $digitemp->getNumSensors();
$sensors = []; $sensors = [];
for ($i = 0; $i < $num; ++$i) { for ($i = 0; $i < $num; ++$i) {
@ -29,8 +29,8 @@ if ($do_send) {
$from_name = $config['mail_from_name']; $from_name = $config['mail_from_name'];
$to = $config['mail_alert_to']; $to = $config['mail_alert_to'];
$subject = $config['mail_alert_subject']; $subject = $config['mail_alert_subject'];
$loader = new \Twig\Loader\FilesystemLoader(APPDIR.'/'.$config['templates_dir']); $loader = new Twig\Loader\FilesystemLoader(APPDIR.'/'.$config['templates_dir']);
$twig = new \Twig\Environment($loader); $twig = new Twig\Environment($loader);
$data = [ $data = [
'range' => [ 'range' => [
'upper' => $upper, 'upper' => $upper,
@ -45,7 +45,7 @@ if ($do_send) {
]; ];
$body = $twig->render($config['mail_alert_template'], $data); $body = $twig->render($config['mail_alert_template'], $data);
$from = new \Orrisroot\Mail\Address($from_name, $from); $from = new Orrisroot\Mail\Address($from_name, $from);
$tos = [new \Orrisroot\Mail\Address($to, $to)]; $tos = [new Orrisroot\Mail\Address($to, $to)];
\Orrisroot\Mail\UTF8_Mailer::sendMail($from, $tos, $subject, $body); Orrisroot\Mail\UTF8_Mailer::sendMail($from, $tos, $subject, $body);
} }

View File

@ -6,8 +6,8 @@ require_once APPDIR.'/vendor/autoload.php';
$config = json_decode(file_get_contents(APPDIR.'/etc/config.json'), true); $config = json_decode(file_get_contents(APPDIR.'/etc/config.json'), true);
$digitemp = new \Orrisroot\DigiTemp($config['digitemp'], APPDIR.'/'.$config['digitemp_config']); $digitemp = new Orrisroot\DigiTemp($config['digitemp'], APPDIR.'/'.$config['digitemp_config']);
$rrdtemp = new \Orrisroot\Rrd\Temperature(APPDIR.'/'.$config['database_dir']); $rrdtemp = new Orrisroot\Rrd\Temperature(APPDIR.'/'.$config['database_dir']);
$num = $digitemp->getNumSensors(); $num = $digitemp->getNumSensors();
$sensors = []; $sensors = [];
for ($i = 0; $i < $num; ++$i) { for ($i = 0; $i < $num; ++$i) {
@ -20,8 +20,8 @@ $from = $config['mail_from'];
$from_name = $config['mail_from_name']; $from_name = $config['mail_from_name'];
$to = $config['mail_info_to']; $to = $config['mail_info_to'];
$subject = $config['mail_info_subject']; $subject = $config['mail_info_subject'];
$loader = new \Twig\Loader\FilesystemLoader(APPDIR.'/'.$config['templates_dir']); $loader = new Twig\Loader\FilesystemLoader(APPDIR.'/'.$config['templates_dir']);
$twig = new \Twig\Environment($loader); $twig = new Twig\Environment($loader);
$data = [ $data = [
'from' => [ 'from' => [
'name' => $from_name, 'name' => $from_name,
@ -32,6 +32,6 @@ $data = [
]; ];
$body = $twig->render($config['mail_info_template'], $data); $body = $twig->render($config['mail_info_template'], $data);
$from = new \Orrisroot\Mail\Address($from_name, $from); $from = new Orrisroot\Mail\Address($from_name, $from);
$tos = [new \Orrisroot\Mail\Address($to, $to)]; $tos = [new Orrisroot\Mail\Address($to, $to)];
\Orrisroot\Mail\UTF8_Mailer::sendMail($from, $tos, $subject, $body); Orrisroot\Mail\UTF8_Mailer::sendMail($from, $tos, $subject, $body);

View File

@ -6,8 +6,8 @@ require_once APPDIR.'/vendor/autoload.php';
$config = json_decode(file_get_contents(APPDIR.'/etc/config.json'), true); $config = json_decode(file_get_contents(APPDIR.'/etc/config.json'), true);
$digitemp = new \Orrisroot\DigiTemp($config['digitemp'], APPDIR.'/'.$config['digitemp_config']); $digitemp = new Orrisroot\DigiTemp($config['digitemp'], APPDIR.'/'.$config['digitemp_config']);
$rrdtemp = new \Orrisroot\Rrd\Temperature(APPDIR.'/'.$config['database_dir']); $rrdtemp = new Orrisroot\Rrd\Temperature(APPDIR.'/'.$config['database_dir']);
$num = $digitemp->getNumSensors(); $num = $digitemp->getNumSensors();
for ($i = 0; $i < $num; ++$i) { for ($i = 0; $i < $num; ++$i) {
$id = $digitemp->getSensorId($i); $id = $digitemp->getSensorId($i);