mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Clean up some code.
This commit is contained in:
@@ -18,11 +18,11 @@ class IsValidDiscordUrl implements ValidationRule
|
||||
public function validate(string $attribute, mixed $value, \Closure $fail): void
|
||||
{
|
||||
$value = (string)$value;
|
||||
if('' === $value) {
|
||||
if ('' === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!str_starts_with($value, 'https://discord.com/api/webhooks/')) {
|
||||
if (!str_starts_with($value, 'https://discord.com/api/webhooks/')) {
|
||||
$fail('validation.active_url')->translate();
|
||||
$message = sprintf('IsValidDiscordUrl: "%s" is not a discord URL.', substr($value, 0, 255));
|
||||
Log::debug($message);
|
||||
|
@@ -18,11 +18,11 @@ class IsValidSlackOrDiscordUrl implements ValidationRule
|
||||
public function validate(string $attribute, mixed $value, \Closure $fail): void
|
||||
{
|
||||
$value = (string)$value;
|
||||
if('' === $value) {
|
||||
if ('' === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!str_starts_with($value, 'https://hooks.slack.com/services/') && !str_starts_with($value, 'https://discord.com/api/webhooks/')) {
|
||||
if (!str_starts_with($value, 'https://hooks.slack.com/services/') && !str_starts_with($value, 'https://discord.com/api/webhooks/')) {
|
||||
$fail('validation.active_url')->translate();
|
||||
$message = sprintf('IsValidSlackUrl: "%s" is not a discord or slack URL.', substr($value, 0, 255));
|
||||
Log::debug($message);
|
||||
|
@@ -18,11 +18,11 @@ class IsValidSlackUrl implements ValidationRule
|
||||
public function validate(string $attribute, mixed $value, \Closure $fail): void
|
||||
{
|
||||
$value = (string)$value;
|
||||
if('' === $value) {
|
||||
if ('' === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!str_starts_with($value, 'https://hooks.slack.com/services/')) {
|
||||
if (!str_starts_with($value, 'https://hooks.slack.com/services/')) {
|
||||
$fail('validation.active_url')->translate();
|
||||
$message = sprintf('IsValidSlackUrl: "%s" is not a slack URL.', substr($value, 0, 255));
|
||||
Log::debug($message);
|
||||
|
Reference in New Issue
Block a user