Skip to content

Commit 2c9855d

Browse files
committed
Improve Notification folder location
1 parent 0306feb commit 2c9855d

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

app/Notification/MessageTypeEnum.php renamed to app/Notification/NotificationTypeEnum.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @package App\Notification
1010
* @method static string ERROR()
1111
*/
12-
final class MessageTypeEnum
12+
final class NotificationTypeEnum
1313
{
1414
private const ERROR = 'error';
1515

app/Slack/SlackNotification.php renamed to app/Notification/Slack/SlackNotification.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33

4-
namespace App\Slack;
4+
namespace App\Notification\Slack;
55

66

77
use App\Notification\AppNotification;

app/Slack/SlackStylizedMessageCreator.php renamed to app/Notification/Slack/SlackStylizedMessageCreator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22

33

4-
namespace App\Slack;
4+
namespace App\Notification\Slack;
55

66

7-
use App\Notification\MessageTypeEnum;
7+
use App\Notification\NotificationTypeEnum;
88
use App\Notification\StatusCodeEnum;
99
use InvalidArgumentException;
1010

@@ -20,7 +20,7 @@ public function __construct(string $message, string $messageType)
2020
private static function getSlylizedMessageByType(string $message, string $messageType): array
2121
{
2222
switch ($messageType) {
23-
case MessageTypeEnum::ERROR():
23+
case NotificationTypeEnum::ERROR():
2424
return self::getErrorMessageStructure($message);
2525
default:
2626
throw new InvalidArgumentException("Invalid message type: '{$messageType}'", StatusCodeEnum::NOT_FOUND());
@@ -38,7 +38,7 @@ private static function getErrorMessageStructure(string $message): array
3838
'type' => 'section',
3939
'text' => [
4040
'type' => 'mrkdwn',
41-
'text' => "[{$currentDate}] " . strtoupper(MessageTypeEnum::ERROR()) . ' :this-is-fine-fire:'
41+
'text' => "[{$currentDate}] " . strtoupper(NotificationTypeEnum::ERROR()) . ' :this-is-fine-fire:'
4242
]
4343
],
4444
[

app/Route/Router.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
namespace App\Route;
55

66

7-
use App\Notification\MessageTypeEnum;
7+
use App\Notification\NotificationTypeEnum;
88
use App\Notification\StatusCodeEnum;
9-
use App\Slack\SlackNotification;
9+
use App\Notification\Slack\SlackNotification;
1010
use InvalidArgumentException;
1111
use ReflectionException;
1212
use ReflectionMethod;
@@ -39,7 +39,7 @@ private static function createReflectionMethod(array $uriContent): ReflectionMet
3939
try {
4040
return new ReflectionMethod($uriContent['namespace'], $uriContent['method']);
4141
} catch (ReflectionException $exception) {
42-
(new SlackNotification($exception->getMessage(), MessageTypeEnum::ERROR()))->notify();
42+
(new SlackNotification($exception->getMessage(), NotificationTypeEnum::ERROR()))->notify();
4343
}
4444
}
4545
}

tests/Notification/SlackNotificationTest.php renamed to tests/Notification/Slack/SlackNotificationTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22

3-
namespace App\Test\Notification;
3+
namespace App\Test\Notification\Slack;
44

5-
use App\Notification\MessageTypeEnum;
6-
use App\Slack\SlackNotification;
5+
use App\Notification\NotificationTypeEnum;
6+
use App\Notification\Slack\SlackNotification;
77
use PHPUnit\Framework\Assert;
88
use PHPUnit\Framework\TestCase;
99

@@ -16,7 +16,7 @@ class SlackNotificationTest extends TestCase
1616
*/
1717
public static function test_SlackNotification_ShouldNotify(): void
1818
{
19-
$notification = new SlackNotification($notifyText = 'Test Notification', $messageType = MessageTypeEnum::ERROR());
19+
$notification = new SlackNotification($notifyText = 'Test Notification', $messageType = NotificationTypeEnum::ERROR());
2020
$notificationResponse = $notification->notify();
2121

2222
$expectedStatusCodeOK = 200;

tests/Slack/SlackStylizedMessageCreatorTest.php renamed to tests/Notification/Slack/SlackStylizedMessageCreatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22

3-
namespace App\Test\Slack;
3+
namespace App\Test\Notification\Slack;
44

55
use App\Notification\StatusCodeEnum;
6-
use App\Slack\SlackStylizedMessageCreator;
6+
use App\Notification\Slack\SlackStylizedMessageCreator;
77
use InvalidArgumentException;
88
use PHPUnit\Framework\TestCase;
99

0 commit comments

Comments
 (0)