Skip to content

Commit 98b7d5c

Browse files
committed
BaseCoding
1 parent 3aed7c9 commit 98b7d5c

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

src/Generators/Statements/NotificationGenerator.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,11 @@ public function output(array $tree): array
2929
foreach ($tree['controllers'] as $controller) {
3030
foreach ($controller->methods() as $method => $statements) {
3131
foreach ($statements as $statement) {
32-
if (!$statement instanceof SendStatement) {
32+
if (! $statement instanceof SendStatement) {
3333
continue;
3434
}
3535

36-
if ($statement->type() !== SendStatement::TYPE_NOTIFICATION_WITH_FACADE
37-
&& $statement->type() !== SendStatement::TYPE_NOTIFICATION_WITH_MODEL
38-
) {
36+
if (! $statement->isNotification()) {
3937
continue;
4038
}
4139

src/Generators/TestGenerator.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,7 @@ protected function buildTestCases(Controller $controller)
116116

117117
foreach ($statements as $statement) {
118118
if ($statement instanceof SendStatement) {
119-
if ($statement->type() === SendStatement::TYPE_NOTIFICATION_WITH_FACADE
120-
|| $statement->type() === SendStatement::TYPE_NOTIFICATION_WITH_MODEL
121-
) {
119+
if ($statement->isNotification()) {
122120
$this->addImport($controller, 'Illuminate\\Support\\Facades\\Notification');
123121
$this->addImport($controller, config('blueprint.namespace') . '\\Notification\\' . $statement->mail());
124122

src/Models/Statements/SendStatement.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
class SendStatement
77
{
88
const TYPE_MAIL = 'mail';
9-
109
const TYPE_NOTIFICATION_WITH_FACADE = 'notification_with_facade';
11-
1210
const TYPE_NOTIFICATION_WITH_MODEL = 'notification_with_model';
1311

1412
/**
@@ -75,6 +73,11 @@ public function output()
7573
return $this->mailOutput();
7674
}
7775

76+
public function isNotification()
77+
{
78+
return $this->type() === SendStatement::TYPE_NOTIFICATION_WITH_FACADE || $this->type() === SendStatement::TYPE_NOTIFICATION_WITH_MODEL;
79+
}
80+
7881
private function mailOutput()
7982
{
8083
$code = 'Mail::';

0 commit comments

Comments
 (0)