]> Raphaël G. Git Repositories - airbundle/commitdiff
Reorder constructor arguments
authorRaphaël Gertz <git@rapsys.eu>
Thu, 7 Mar 2024 20:47:34 +0000 (21:47 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Thu, 7 Mar 2024 20:47:34 +0000 (21:47 +0100)
Use env variables to set google client, project and secret
Cleanup

Command/Calendar2Command.php

index 0ddcd3ff3213a5d4c1a42e4a05df29c4a62dc9a4..c0a739fccdd02d85e52259e8967ea6bd60087fff 100644 (file)
@@ -60,22 +60,18 @@ class Calendar2Command extends Command {
 
        /**
         * {@inheritdoc}
 
        /**
         * {@inheritdoc}
-        *
-        * @param string $project The google project
-        * @param string $client The google client
-        * @param string $secret The google secret
         */
         */
-       public function __construct(ManagerRegistry $doctrine, RouterInterface $router, SluggerUtil $slugger, TranslatorInterface $translator, string $locale, string $project, string $client, string $secret) {
+       public function __construct(ManagerRegistry $doctrine, string $locale, RouterInterface $router, SluggerUtil $slugger, TranslatorInterface $translator) {
                //Call parent constructor
                //Call parent constructor
-               parent::__construct($doctrine, $router, $slugger, $translator, $locale);
+               parent::__construct($doctrine, $locale, $router, $slugger, $translator);
 
                //Set google client
                $this->client = new Client(
                        [
 
                //Set google client
                $this->client = new Client(
                        [
-                               'application_name' => $project,
-                               'client_id' => $client,
-                               'client_secret' => $secret,
-                               'redirect_uri' => $this->router->generate('rapsys_air_google_callback', [], UrlGeneratorInterface::ABSOLUTE_URL),
+                               'application_name' => $_ENV['RAPSYSAIR_GOOGLE_PROJECT'],
+                               'client_id' => $_ENV['RAPSYSAIR_GOOGLE_CLIENT'],
+                               'client_secret' => $_ENV['RAPSYSAIR_GOOGLE_SECRET'],
+                               'redirect_uri' => $this->router->generate('rapsysair_google_callback', [], UrlGeneratorInterface::ABSOLUTE_URL),
                                'scopes' => $this->scopes,
                                'access_type' => 'offline',
                                #'login_hint' => $user->getMail(),
                                'scopes' => $this->scopes,
                                'access_type' => 'offline',
                                #'login_hint' => $user->getMail(),