54
54
*/
55
55
final class MakeWebhook extends AbstractMaker implements InputAwareMakerInterface
56
56
{
57
-
58
57
private const WEBHOOK_CONFIG_PATH = 'config/packages/webhook.yaml ' ;
59
58
private YamlSourceManipulator $ ysm ;
60
59
@@ -77,14 +76,14 @@ public static function getCommandDescription(): string
77
76
public function configureCommand (Command $ command , InputConfiguration $ inputConfig ): void
78
77
{
79
78
$ command
80
- ->addArgument ('name ' , InputArgument::OPTIONAL , sprintf ( 'Name of the webhook to create (e.g. <fg=yellow>github, stripe, ...</>) ' ) )
81
- ->setHelp (file_get_contents (__DIR__ . '/../Resources/help/MakeWebhook.txt ' ))
79
+ ->addArgument ('name ' , InputArgument::OPTIONAL , 'Name of the webhook to create (e.g. <fg=yellow>github, stripe, ...</>) ' )
80
+ ->setHelp (file_get_contents (__DIR__ . '/../Resources/help/MakeWebhook.txt ' ))
82
81
;
83
82
84
83
$ inputConfig ->setArgumentAsNonInteractive ('name ' );
85
84
}
86
85
87
- public function configureDependencies (DependencyBuilder $ dependencies , ? InputInterface $ input = null )
86
+ public function configureDependencies (DependencyBuilder $ dependencies , InputInterface $ input = null )
88
87
{
89
88
$ dependencies ->addClassDependency (
90
89
AbstractRequestParser::class,
@@ -132,11 +131,11 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
132
131
{
133
132
$ webhookName = $ input ->getArgument ('name ' );
134
133
$ requestParserDetails = $ this ->generator ->createClassNameDetails (
135
- Str::asClassName ($ webhookName . 'RequestParser ' ),
134
+ Str::asClassName ($ webhookName. 'RequestParser ' ),
136
135
'Webhook \\'
137
136
);
138
137
$ remoteEventHandlerDetails = $ this ->generator ->createClassNameDetails (
139
- Str::asClassName ($ webhookName . 'WebhookHandler ' ),
138
+ Str::asClassName ($ webhookName. 'WebhookHandler ' ),
140
139
'RemoteEvent \\'
141
140
);
142
141
@@ -165,7 +164,7 @@ private function addToYamlConfig(string $webhookName, ClassNameDetails $requestP
165
164
}
166
165
$ this ->ysm = new YamlSourceManipulator ($ yamlConfig );
167
166
$ arrayConfig = $ this ->ysm ->getData ();
168
- if (key_exists ($ webhookName , $ arrayConfig ['framework ' ]['webhook ' ]['routing ' ] ?? [])) {
167
+ if (\array_key_exists ($ webhookName , $ arrayConfig ['framework ' ]['webhook ' ]['routing ' ] ?? [])) {
169
168
throw new \InvalidArgumentException ('A webhook with this name already exists ' );
170
169
}
171
170
@@ -179,9 +178,6 @@ private function addToYamlConfig(string $webhookName, ClassNameDetails $requestP
179
178
}
180
179
181
180
/**
182
- * @param ConsoleStyle $io
183
- * @param ClassNameDetails $requestParserDetails
184
- * @return void
185
181
* @throws \Exception
186
182
*/
187
183
public function generateRequestParser (ConsoleStyle $ io , ClassNameDetails $ requestParserDetails ): void
@@ -253,6 +249,7 @@ private function askForNextRequestMatcher(ConsoleStyle $io, array $addedMatchers
253
249
return null ;
254
250
}
255
251
}
252
+
256
253
return $ matcherName ;
257
254
}
258
255
0 commit comments