From 7ce7c3637d69c25c2de0d01a85078fe71c227e93 Mon Sep 17 00:00:00 2001 From: aymm Date: Tue, 9 Mar 2021 19:11:23 +0000 Subject: [PATCH] Extended API consntructor --- src/APnutI.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/APnutI.php b/src/APnutI.php index 056a6eb..5eec2b4 100644 --- a/src/APnutI.php +++ b/src/APnutI.php @@ -66,8 +66,13 @@ class APnutI public static $USER_DESCRIPTION_MAX_LENGTH; public static $USER_USERNAME_MAX_LENGTH; - public function __construct(?string $log_path = null) - { + public function __construct( + ?string $client_secret = null, + ?string $client_id = null, + ?string $needed_scope = null, + ?string $app_name = null, + ?string $log_path = null + ) { $this->logger = empty($log_path) ? new NullLogger() : new Logger($this->app_name); $this->token_session_key = $this->app_name.'access_token'; $this->token_redirect_after_auth = $this->app_name @@ -82,6 +87,18 @@ class APnutI } else { $this->logger->debug('No access token in session'); } + if (!empty($client_secret)) { + $this->client_secret = $client_secret; + } + if (!empty($client_id)) { + $this->client_id = $client_id; + } + if (!empty($needed_scope)) { + $this->needed_scope = $needed_scope; + } + if (!empty($app_name)) { + $this->app_name = $app_name; + } } /**