22
33namespace Drupal \os2loop_cura_login \Drush \Commands ;
44
5- use Consolidation \OutputFormatters \StructuredData \RowsOfFields ;
65use Drupal \Component \Datetime \TimeInterface ;
76use Drupal \Core \DependencyInjection \AutowireTrait ;
87use Drupal \Core \Url ;
9- use Drupal \Core \Utility \Token ;
108use Drush \Attributes as CLI ;
119use Drush \Commands \DrushCommands ;
1210use Firebase \JWT \JWT ;
13- use Http \Client \HttpClient ;
1411use Psr \Http \Client \ClientInterface ;
15- use Symfony \Component \DependencyInjection \ContainerInterface ;
1612use Symfony \Component \HttpFoundation \Request ;
1713
1814/**
1915 * A Drush commandfile.
2016 */
21- final class Os2loopCuraLoginCommands extends DrushCommands
22- {
17+ final class Os2loopCuraLoginCommands extends DrushCommands {
2318 use AutowireTrait;
2419
2520 /**
@@ -42,10 +37,10 @@ public function __construct(
4237 public function commandName (
4338 $ username ,
4439 $ options = [
45- 'get ' => null ,
46- 'secret ' => null ,
40+ 'get ' => NULL ,
41+ 'secret ' => NULL ,
4742 'algorithm ' => 'HS256 ' ,
48- ]
43+ ],
4944 ) {
5045 // https://github.com/firebase/php-jwt?tab=readme-ov-file#example
5146 $ payload = [
@@ -62,11 +57,12 @@ public function commandName(
6257 if ($ name = $ options ['get ' ]) {
6358 $ method = Request::METHOD_GET ;
6459 $ routeParameters [$ name ] = $ jwt ;
65- } else {
60+ }
61+ else {
6662 $ method = Request::METHOD_POST ;
6763 $ requestOptions ['body ' ] = $ jwt ;
6864 }
69- $ url = Url::fromRoute ('os2loop_cura_login.start ' , $ routeParameters )->setAbsolute ()->toString (true )->getGeneratedUrl ();
65+ $ url = Url::fromRoute ('os2loop_cura_login.start ' , $ routeParameters )->setAbsolute ()->toString (TRUE )->getGeneratedUrl ();
7066 $ this ->io ()->writeln ($ method === Request::METHOD_POST
7167 ? sprintf ('POST \'ing to %s ' , $ url )
7268 : sprintf ('GET \'ing %s ' , $ url ),
@@ -78,7 +74,7 @@ public function commandName(
7874 $ url ,
7975 $ request ->getStatusCode (),
8076 $ request ->getBody ()->getContents (),
81- ], true );
77+ ], TRUE );
8278 die (__FILE__ . ': ' . __LINE__ . ': ' . __METHOD__ );
8379 }
8480
0 commit comments