From 102199594e243c40dacb0e6f517d85c680908695 Mon Sep 17 00:00:00 2001 From: Ingmar Szmais Date: Thu, 12 Sep 2019 14:00:07 +0200 Subject: [PATCH] add docs and optional client_id and client_secret --- PlagScan/API.php | 4 ++++ PlagScan/Helper/Base.php | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/PlagScan/API.php b/PlagScan/API.php index a382205..5b9be21 100644 --- a/PlagScan/API.php +++ b/PlagScan/API.php @@ -22,6 +22,8 @@ class API protected static $instance; /** + * @param $host + * @param string $version * @return API */ public static function getInstance($host, $version = 'v3') : API @@ -34,6 +36,8 @@ class API /** * PlagScanApi constructor. + * @param $host + * @param $version */ public function __construct($host, $version) { diff --git a/PlagScan/Helper/Base.php b/PlagScan/Helper/Base.php index d55f06c..e23caf0 100644 --- a/PlagScan/Helper/Base.php +++ b/PlagScan/Helper/Base.php @@ -20,6 +20,8 @@ class Base /** * Ping constructor. + * @param $host + * @param string $version */ public function __construct($host, $version = 'v3') { @@ -52,8 +54,12 @@ class Base public function createAccessToken(string $client_id = '', string $client_secret = '') { $settings = new \ilSetting('psx'); - $client_id = $settings->get('psx_clientid'); - $client_secret = $settings->get('psx_apikey'); + if($client_id === ''){ + $client_id = $settings->get('psx_clientid'); + } + if($client_secret === ''){ + $client_secret = $settings->get('psx_apikey'); + } $response = $this->handler->request('token', 'POST', '', [ 'client_id' => $client_id, -- GitLab